Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 #ifndef BOOST_MPL_O1_SIZE_IMPL_HPP_INCLUDED
0003 #define BOOST_MPL_O1_SIZE_IMPL_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/O1_size_fwd.hpp>
0018 #include <boost/mpl/long.hpp>
0019 #include <boost/mpl/if.hpp>
0020 #include <boost/mpl/aux_/has_size.hpp>
0021 #include <boost/mpl/aux_/config/forwarding.hpp>
0022 #include <boost/mpl/aux_/config/static_constant.hpp>
0023 #include <boost/mpl/aux_/config/msvc.hpp>
0024 #include <boost/mpl/aux_/config/workaround.hpp>
0025 
0026 namespace boost { namespace mpl {
0027 
0028 // default implementation - returns 'Sequence::size' if sequence has a 'size'
0029 // member, and -1 otherwise; conrete sequences might override it by 
0030 // specializing either the 'O1_size_impl' or the primary 'O1_size' template
0031 
0032 #   if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
0033     && !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
0034 
0035 namespace aux {
0036 template< typename Sequence > struct O1_size_impl
0037     : Sequence::size
0038 {
0039 };
0040 }
0041 
0042 template< typename Tag >
0043 struct O1_size_impl
0044 {
0045     template< typename Sequence > struct apply
0046 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
0047         : if_<
0048               aux::has_size<Sequence>
0049             , aux::O1_size_impl<Sequence>
0050             , long_<-1>
0051             >::type
0052     {
0053 #else
0054     {
0055         typedef typename if_<
0056               aux::has_size<Sequence>
0057             , aux::O1_size_impl<Sequence>
0058             , long_<-1>
0059             >::type type;
0060 
0061         BOOST_STATIC_CONSTANT(long, value =
0062               (if_<
0063                   aux::has_size<Sequence>
0064                 , aux::O1_size_impl<Sequence>
0065                 , long_<-1>
0066                 >::type::value)
0067             );
0068 #endif
0069     };
0070 };
0071 
0072 #   else // BOOST_MSVC
0073 
0074 template< typename Tag >
0075 struct O1_size_impl
0076 {
0077     template< typename Sequence > struct apply
0078         : long_<-1>
0079         {
0080         };
0081 };
0082 
0083 #   endif
0084 
0085 }}
0086 
0087 #endif // BOOST_MPL_O1_SIZE_IMPL_HPP_INCLUDED