|
Boost Users : |
Subject: Re: [Boost-users] How to detect the presence of a particular type of constructor?
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2009-04-25 15:31:42
2009/4/25 Steven Watanabe <watanabesj_at_[hidden]>
> AMDG
>
> Siegfried Kettlitz wrote:
>
>> Thanks, that is just what i was looking for. :)
>>
>> Apparently that's the key point for detecting the implicit conversion
>> constructor:
>> template< typename From >
>> struct does_conversion_exist
>> {
>> template< typename To > struct result_
>> {
>> static no_type BOOST_TT_DECL _m_check(...);
>> static yes_type BOOST_TT_DECL _m_check(To);
>> static From _m_from;
>> enum { value = sizeof( _m_check(_m_from) ) == sizeof(yes_type) };
>> };
>> };
>>
>>
>> Can this be extended to constructors with more than one parameter?
>>
>>
>
> There is no known way to detect constructors except for
> the special case of implicit conversions.
>
See also the thread (
http://groups.google.com/group/boost-list/browse_thread/thread/e15440218b85122a
)
where I asked for exactly the same thing.
Roman Perepelitsa.
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