Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:49

0001 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
0002 // (C) Copyright 2003-2007 Jonathan Turkanis
0003 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
0005 
0006 // See http://www.boost.org/libs/iostreams for documentation.
0007 
0008 #ifndef BOOST_IOSTREAMS_DETAIL_BOOL_TRAIT_DEF_HPP_INCLUDED
0009 #define BOOST_IOSTREAMS_DETAIL_BOOL_TRAIT_DEF_HPP_INCLUDED     
0010 
0011 #include <boost/config.hpp> // BOOST_STATIC_CONSTANT.
0012 #include <boost/iostreams/detail/template_params.hpp>
0013 #include <boost/mpl/aux_/lambda_support.hpp>
0014 #include <boost/mpl/bool.hpp>
0015 #include <boost/preprocessor/cat.hpp>
0016 #include <boost/preprocessor/repetition/enum_params.hpp>
0017 #include <boost/type_traits/detail/yes_no_type.hpp>
0018  
0019 // 
0020 // Macro name: BOOST_IOSTREAMS_BOOL_TRAIT_DEF
0021 // Description: Used to generate the traits classes is_istream, is_ostream,
0022 //      etc.
0023 //
0024 #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x582))
0025 # define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait)
0026 #else
0027 # define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) BOOST_PP_CAT(trait, _impl_):: 
0028 #endif
0029 #define BOOST_IOSTREAMS_BOOL_TRAIT_DEF(trait, type, arity) \
0030     namespace BOOST_PP_CAT(trait, _impl_) { \
0031       BOOST_IOSTREAMS_TEMPLATE_PARAMS(arity, T) \
0032       type_traits::yes_type helper \
0033           (const volatile type BOOST_IOSTREAMS_TEMPLATE_ARGS(arity, T)*); \
0034       type_traits::no_type helper(...); \
0035       template<typename T> \
0036       struct impl { \
0037            BOOST_STATIC_CONSTANT(bool, value = \
0038            (sizeof(BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) \
0039               helper(static_cast<T*>(0))) == \
0040                 sizeof(type_traits::yes_type))); \
0041       }; \
0042     } \
0043     template<typename T> \
0044     struct trait \
0045         : mpl::bool_<BOOST_PP_CAT(trait, _impl_)::impl<T>::value> \
0046     { BOOST_MPL_AUX_LAMBDA_SUPPORT(1, trait, (T)) }; \
0047     /**/
0048 
0049 #endif // #ifndef BOOST_IOSTREAMS_DETAIL_BOOL_TRAIT_DEF_HPP_INCLUDED