|
Boost Users : |
Subject: Re: [Boost-users] [type_traits] will the future has_operator_left_shift be able to test if a type is serializable to a stream ?
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2011-02-02 03:23:38
> Simply including for instance
> <boost/type_traits/has_operator_left_shift.hpp> on vc80 and vc100 yields :
Could it be a problem of line ending (windows/linux)? Could you try
with that version:
http://www.boostpro.com/vault/index.php?action=downloadfile&filename=type_traits-dos.tar.bz2&directory=Extension&
> Anyway, it seems that nothing in the documentation indicates the new traits
> are limited to numeric types.
It should not be limited to numeric types.
> Moreover it sort of works for testing if a type is serializable to an
> std::ostream :
> BOOST_STATIC_ASSERT(( boost::has_operator_left_shift< std::ostream, int
>>::value ));
> And it also works for far more advanced cases (like a type convertible to
> another type which is serializable, or a class deriving from another class
> which is serializable, etc..)
OK, thank you for testing this.
> However it doesn't work with a pointer type, for instance this fails :
> BOOST_STATIC_ASSERT(( boost::has_operator_left_shift< std::ostream, void*
>>::value ));
Can you say what you mean by it doesn't work? Do you mean compile
error or returns the wrong value?
> Will this use case be supported ?
This should work properly. I will have a look. Thanks for testing.
Frédéric
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net