|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-03-04 08:38:55
"Yutaka Leon Suematsu" <yutaka_at_[hidden]> writes:
>>> I would like to ask if there is a way to evaluate, in compile time,
>>> the existence of a specific constructor, except from the constructor
>>> default and copy constructor (I know the functions
>>> has_trivial_constructor and has_trivial_copy from the type_traits
>>> library). For example in the following code, I would like to
>>> evaluate the existence of both "A(const Config& config)"
>>
>> You can do something like this with is_convertible<Config,A>
>
> Thank you Dave, it works perfect.
>
> If the constructor takes one paramater it can be used , but in the case of
> two or more parameters??
Your out of luck.
> Is it possible to evaluate, in compile time, the existence of a certain
> member function in a class?
Yep. If you know both the name and exact signature, you use SFINAE
with the member function pointer.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net