Boost logo

Boost :

Subject: Re: [boost] [GSoC] [Boost.Hana] Formal review request
From: pfultz2 (pfultz2_at_[hidden])
Date: 2014-08-03 09:37:26

> b) You have one or more full or partial class specializations for
> specific classes/templates/values:
> Basically as above, but if you want to prohibited the default case or
> certain specializations, here's a nice, minimalistic helper to do so

This is a perfect example of when *not* to use static_assert. You should
the class undefined:

    template<typename Context, typename T, typename Enable = void>
    struct serializer_t;

Then the compiler will already give a simple and informative error about the
class being undefined, which is almost the same error you put in the

Futhermore, say I want to know if there is a valid serializer at
and if not then choose a different method. So, I create a predicate to
a valid serializer:

        template<class Context, class T>
        auto requires_(Context ctx, const T& x) -> decltype(
            has_type<typename Context::T, T>(),
            Context::_(x, ctx)

Unfortunately, this won't work because of the hard error, and it won't work
with Concepts Lite either.

`static_assert` can be used to check variants outside of type requirements,
in general, it should not be used for type requirements.

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at