Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: How to conv...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 13 Topic 9564 of 9828
Post > Topic >>

Re: How to convert a pointer to member function type to a const member one

by mcostalba <mcostalba@[EMAIL PROTECTED] > May 6, 2008 at 12:57 AM

On 5 Mag, 15:09, "Roman.Perepeli...@[EMAIL PROTECTED]
"
<Roman.Perepeli...@[EMAIL PROTECTED]
> wrote:
> On 1 May, 21:43, mcostalba <mcosta...@[EMAIL PROTECTED]
> wrote:
>
> > I have to detect if a functor type Fun has a given signature Sig, i.e.
> > if Fun::operator() has a signature Sig
>
> Take a look at is_call_possible metafunction, which was discussed
> in this group before
> (http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/
> thread/4f7c7a96f9afbe44/e5fbc9305539f699#e5fbc9305539f699).
> It seems to do what you want.
>

Thanks Roman for your link.

Actually there are some good ideas in that implementation and I will
try to borrow a few of them...

Unfortunatly it does not fit the bill 100%, indeed:

- Implicit argument type conversion should be avoided in my context,
due to some ambiguites that can arise when there is more then one
candidate among the overload set. So signature matching would be ok to
be strict.

- It seems you have to add a specialization for each argument arity,
in my implementation I would try to avoid this. Indeed my proposed
implementation it's already ok at 95%, the only case for which it
fails is detecting pointers to CONST operator() members with a given
signature.



Anyhow, for interested people, many of the ideas, included overloading
comma operator

template <typename type, typename U>
U& operator,(U&, void_exp_result<type>);

to workaround void return types are also exposed in "Detecting the
Arity of Function Objects"

under the link

http://boost-sandbox.sourceforge.net/libs/proto/doc/html/boost_proto/appendices/implementation/function_arity.html

where an equivalent solution is do***ented by Eric Nibler in his
boost::proto library.

Thanks
Marco

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 13 Posts in Topic:
How to convert a pointer to member function type to a const memb
mcostalba <mcostalba@[  2008-04-30 10:38:30 
Re: How to convert a pointer to member function type to a const
nickf3 <nickf3@[EMAIL   2008-04-30 17:04:17 
Re: How to convert a pointer to member function type to a const
smolensky@[EMAIL PROTECTE  2008-04-30 21:54:58 
Re: How to convert a pointer to member function type to a const
"Devdatt Lad" &  2008-04-30 21:54:37 
Re: How to convert a pointer to member function type to a const
Greg Herlihy <greghe@[  2008-04-30 22:17:24 
Re: How to convert a pointer to member function type to a const
mcostalba <mcostalba@[  2008-05-01 13:43:23 
Re: How to convert a pointer to member function type to a const
"Roman.Perepelitsa@[  2008-05-05 07:09:51 
Re: How to convert a pointer to member function type to a const
mcostalba <mcostalba@[  2008-05-06 00:57:14 
Re: How to convert a pointer to member function type to a const
"Roman.Perepelitsa@[  2008-05-06 08:21:31 
Re: How to convert a pointer to member function type to a const
mcostalba <mcostalba@[  2008-05-06 12:47:31 
Re: How to convert a pointer to member function type to a const
dizzy <dizzy@[EMAIL PR  2008-05-07 11:04:35 
Re: How to convert a pointer to member function type to a const
"Roman.Perepelitsa@[  2008-05-07 11:04:05 
Re: How to convert a pointer to member function type to a const
mcostalba <mcostalba@[  2008-05-07 18:33:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 15:59:44 CDT 2008.