|
Boost : |
Subject: Re: [boost] [GSoC] [Boost.Hana] Formal review request
From: pfultz2 (pfultz2_at_[hidden])
Date: 2014-08-01 07:27:08
> I am therefore rather sticking with static_assert to enforce constraints
> with friendly error messages for the time being until Concepts Lite are
> available as TS or part of the standard.
Using static_assert to enforce constraints can become problematic when used
with concept predicates. That is because static_assert causes a hard error.
So, when its combined with function overloading, I would get a friendly
error
message, rather than the compiler calling the alternative function. This can
be workaround by specializing the trait, which is possible with Tick, but
not
with `concept bool`.
A lot of these problems will start showing up as more people start using
concept predicate in C++11 and beyond. The difference between a hard error
and
template constraint is not really fully understood or utilized by many
libraries. So to be prepared for the future you should use enable_if which
is
a template constraint, instead of static_assert which just produces an
error.
Most modern compilers will produce nice friendly messages for enable_if.
-- View this message in context: http://boost.2283326.n4.nabble.com/Re-GSoC-Boost-Hana-Formal-review-request-tp4665622p4665915.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk