Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6730061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:21:48+00:00 2026-05-26T10:21:48+00:00

FastDelegate refers to http://www.codeproject.com/KB/cpp/FastDelegate.aspx , but I don’t think it is related. I have

  • 0

FastDelegate refers to http://www.codeproject.com/KB/cpp/FastDelegate.aspx, but I don’t think it is related.

I have code like following, and got error.

#include <FastDelegate.h>


using namespace fastdelegate;

template <typename T>
T Getter() {}

template <typename T>
void Setter(T) {}

template <typename T>
class Prop
{
public:
    typedef FastDelegate0<T> Getter;
    typedef FastDelegate1<T> Setter;

    Prop(Getter getter, Setter setter) :
        m_Getter(getter), m_Setter(setter)
    {

    }

private:
    Getter m_Getter;
    Setter m_Setter;
};

template <typename T>
inline Prop<T>* MakeProp(FastDelegate0<T> getter, FastDelegate1<T> setter)
{
    return new Prop<T>(getter, setter);
}

static int Target = 0;
int main()
{
    FastDelegate0<int> fdGetter(Getter<int>);
    Prop<int>* c = MakeProp(fdGetter, Setter<int>);
    // ^^^^ error: no matching function for call to 'MakeProp'
}

If changed the main() to:

int main()
{
    FastDelegate0<int> fdGetter(Getter<int>);
    FastDelegate1<int> fdSetter(Setter<int>);
    Prop<int>* c = MakeProp(fdGetter, fdSetter); // It works.
}

or:

int main()
{
    FastDelegate0<int> fdGetter(Getter<int>);
    Prop<int>* c = MakeProp<int>(fdGetter, Setter<int>); // It works, too.
}

I think, MakeProp() should get the T from fdGetter (which is int, than called the contructor of FastDelegate1<int> automatically. But it did not. Why?

P.S. I would like to save the getter and setter in Prop, any suggestion for this approach is welcome. Maybe it is bad to copy the instance of FastDelegate* during passing arguments in function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:21:49+00:00Added an answer on May 26, 2026 at 10:21 am

    Have you tried

    Prop<int>* c = MakeProp(FastDelegate0<int>(Getter<int>), FastDelegate1<int>(Setter<int>));
    

    ?

    Setter<int> cannot be converted to FastDelegate1<T>!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently implementing a timer/callback system using Don Clugston's fastdelegates. (see http://www.codeproject.com/KB/cpp/FastDelegate.aspx )
I've got a problem with my test code. It compiles well, but when I
I have a complex code base at work, and i created a small example
I have the following and having difficulty resolving the error please help. i have
I have been designing a component-based game library, with the overall intention of writing
I'm porting FastDelegate to C++0x using variadic templates. #include FastDelegate.h template<class R=fastdelegate::detail::DefaultVoid, class ...P>
I need to use an event system in C++. I have mainly four requirements
I was doing some digging around into delegate variance after reading the following question
If i declare a delegate public delegate void firstDelegate(string str); firstDelegate handler = Strfunc;
I am at that really boring part in the development of my library, where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.