
on Sun Dec 04 2011, Lorenzo Caminiti <lorcaminiti-AT-gmail.com> wrote:
Hello all,
What's the difference between using a Boost.Parameter type predicate and using a concept?
I think parameter type predicates are unary metafunctions used to resolve the function call, concepts are asserted on the type after the call has been resolved... Is there more?
Overload ordering on concepts, but I see you're not talking about real concepts, just BCCL concepts.
Can I always do with type predicates what I can do with concepts?
No, type predicates are required not to cause a compilation error, so there are limits to what they can detect in C++03 (e.g. copyability). Concept checks are specifically used to cause compilation errors.
Is there ever a reason to use/need both?
For example here has_equal_to is the type predicate while DefautlConstructible is the concept. Could/should I have used has_[...]_default_constructor in and_ the type predicate instead of the DefaultConstructible concept?
I think unless the compiler has implemented a special intrinsic, in C++03 has_[...]_default_constructor is at best an imperfect emulation. -- Dave Abrahams BoostPro Computing http://www.boostpro.com