C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delegates

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Martin Vejnár
Guest





PostPosted: Thu May 18, 2006 7:21 pm    Post subject: Delegates Reply with quote



I've just read a post in comp.lang.c++.moderated submitted by Niek
Sanders. There is a link to a very interesting article:
[http://www.codeproject.com/cpp/FastDelegate.asp]

As explained in the article, native support for delegates (e.g. pointers
to members bound to an object) would boost performance of code which
uses delegates heavily.

Is there any reason why C++ doesn't support them? Did C++ committee
discuss this subject?
--
Martin

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Seungbeom Kim
Guest





PostPosted: Tue May 23, 2006 6:21 am    Post subject: Re: Delegates Reply with quote



Martin Vejnár wrote:
Quote:
I've just read a post in comp.lang.c++.moderated submitted by Niek
Sanders. There is a link to a very interesting article:
[http://www.codeproject.com/cpp/FastDelegate.asp]

As explained in the article, native support for delegates (e.g. pointers
to members bound to an object) would boost performance of code which
uses delegates heavily.

Is there any reason why C++ doesn't support them? Did C++ committee
discuss this subject?

I cannot give you the answer, but I'd like to add that I also have
always wished that I could use something like Boost.Function without
worrying about the performance overhead. From the article, it seems
that achieving that goal is possible and much easier and better if
supported by the Standard.

--
Seungbeom Kim

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
SuperKoko
Guest





PostPosted: Tue May 23, 2006 3:21 pm    Post subject: Re: Delegates Reply with quote



Martin Vejnár wrote:
Quote:
I've just read a post in comp.lang.c++.moderated submitted by Niek
Sanders. There is a link to a very interesting article:
[http://www.codeproject.com/cpp/FastDelegate.asp]

As explained in the article, native support for delegates (e.g. pointers
to members bound to an object) would boost performance of code which
uses delegates heavily.

Is there any reason why C++ doesn't support them? Did C++ committee
discuss this subject?

If C++0x library supports delegates, it will be possible for the

implementation to write native optimizations. That's why the standard
reserves all names of the standard library.


---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Guest






PostPosted: Thu Jun 08, 2006 9:12 pm    Post subject: Re: Delegates Reply with quote

Martin Vejnár wrote:
Quote:
I've just read a post in comp.lang.c++.moderated submitted by Niek
Sanders. There is a link to a very interesting article:
[http://www.codeproject.com/cpp/FastDelegate.asp]

As explained in the article, native support for delegates (e.g. pointers
to members bound to an object) would boost performance of code which
uses delegates heavily.

Is there any reason why C++ doesn't support them? Did C++ committee
discuss this subject?

In Standard C++, a way to implement "delegates" is illustrated by
this:

struct BaseDelegateSetI
{
virtual void setI(int i) = 0;
};

template<class C>
class DelegateSetI
{
private:
C &c:
public:
DelegateSetI(C &cc) : c(cc) { }
void setI(int i) { c.setI(i); }
};

So, in deciding whether to add native delegates to the
Standard, the rant against member function pointers
is perhaps a red herring.

This example would seem to indicate that delegates can
be thought of as a shorthand for abstract base classes
with a single member function. It's true that native
delegates would be little more optimal in both space
and time when evaluated at the level of a single function
call. But what if the object calling member functions
of the instance of C had to call several different members
of C? Then the use of delegates would result in
unecessary redundant references to C (in each
delegate).

So I think it's still an open question whether
using builtin delegates would really result in
optimizing the object code generated from
"typical" C++ code.

If it's truely a common case for classes to
have a single virtual function, it might be
possible to optimize for that case
by not having a vtable, and putting the
function pointer in the object in place of
the vpointer.


---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.