I am trying to to do a static assertion to check that for two types A and B; class A should have a public constructor of signature A(B& b) or A(const B& b).
I would like to have something of sort of is_constructable_from<A, B>::value
which evaluates to true
if there exists a public A(B& b) or A(const B& b) or A(B b).
I guess this is somewhat different than boost is_convertible type_trait.
How do I achieve this?
Have I missed something which will do this in Boost Type Traits or Concept Check library?
Right now I need this to do a static check that the expression A a(b)
is a valid one, which as suggested by Sehe is a less restrictive than the previous concept. A solution for both the cases are welcome. I am allowed to use Boost.
const&
or a value it can accept the result of implicit conversions (temporaries). – sehe