Boost logo

Boost :

From: Carlo Wood (carlo_at_[hidden])
Date: 2004-08-31 18:43:44


> --- ../iostream/boost/io/operations.hpp Tue Aug 31 23:12:01 2004
> +++ boost/io/operations.hpp Tue Aug 31 23:23:59 2004
> @@ -99,7 +99,7 @@ struct read_impl<input> {
>
> template<typename T>
> static void putback(T&, BOOST_IO_CHAR_TYPE(T))
> - { BOOST_STATIC_ASSERT(false); }
> + { BOOST_STATIC_ASSERT(true); }

This is caused by the fact that since 3.4.1, template bodies
that do not depend on a template parameter need to
be compilable. Thus, the body *is* checked for compilation
problems, even when putback is never instantiated.

Obviously, the change from false -> true is not the solution here.

If 'T' would always define a type 'false', then this
might work (as example), causing 'T' to be part of the
body:

    template<typename T>
    static void putback(T&, BOOST_IO_CHAR_TYPE(T))
    { BOOST_STATIC_ASSERT(typename T::false); }

Hmm, what about:

    template<typename T>
    static void putback(T&, BOOST_IO_CHAR_TYPE(T))
    { BOOST_STATIC_ASSERT(sizeof(T) == 0); }

Does that work?

-- 
Carlo Wood <carlo_at_[hidden]>

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk