Skip to content

New system requires class as part of the type #4

Open

Description

@Gerharddc

I am not sure if this was intentional but the new implementation requires that the type of the class be part of the template type for member functions. This was not the case with the previous implementation. In other words, the type of a delegate now restricts it for use on a certain type.

I would assume that this is not part of the plan because if this is allowable then the concept of this delegate system does not make it any more useful than standard C++ member function pointers. Or am I missing something?

Activity

  1. changed the title [-]New system requires Class as part of the type[/-] [+]New system requires class as part of the type[/+] on Aug 22, 2015
  2. timoalho commented on Jun 11, 2016

    @timoalho

    I have to agree with this, the fact that the type of the caller appears in the type of the delegate seems to defeat the whole purpose of the delegate...

    If I say, for example

    void set_delegate(delegate<void (*) (int, int)>) {
    //...store the delegate somewhere
    }
    

    then

    set_delegate(make_delegate(&MyClass::foo, myClassInstance));
    

    does not compile.

  3. jcelerier commented on Jul 22, 2016

    @jcelerier

    +1, bitten with this.
    You should at least change the examples on the front page because they give hope that the delegate is able to do this.

  4. jcelerier commented on Nov 22, 2016

    @jcelerier

    @marcmo Wouldn't C++17's template argument deduction help overcome this ?

  5. marcmo commented on Nov 23, 2016

    @marcmo
    Owner

    you are of course right guys...I overlooked this in my enthusiasm to get rid of some template syntax by using macros...
    will probably switch back to using the more verbose but working syntax. @jcelerier C++17 might help but then again this library was meant to be used in scenarios where you cannot expect more then C++98 => highly portable but still really good performance.

  6. koemeet commented on Dec 31, 2017

    @koemeet

    just noticed this as well, any plans on maybe providing a working branch or tag a certain commit in which it was working as described in this issue?

  7. marcmo commented on Jan 2, 2018

    @marcmo
    Owner

    Hi @koemeet, I will provide an updated version soon. totally forgot about it.

  8. hparracho commented on Mar 30, 2018

    @hparracho

    Hi @marcmo! Was this issue dropped or do you still have plans to update the class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions