os/ossrv/ossrv_pub/boost_apis/boost/mpl/is_sequence.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
sl@0
     2
#ifndef BOOST_MPL_IS_SEQUENCE_HPP_INCLUDED
sl@0
     3
#define BOOST_MPL_IS_SEQUENCE_HPP_INCLUDED
sl@0
     4
sl@0
     5
// Copyright Aleksey Gurtovoy 2002-2004
sl@0
     6
//
sl@0
     7
// Distributed under the Boost Software License, Version 1.0. 
sl@0
     8
// (See accompanying file LICENSE_1_0.txt or copy at 
sl@0
     9
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
    10
//
sl@0
    11
// See http://www.boost.org/libs/mpl for documentation.
sl@0
    12
sl@0
    13
// $Source: /cvsroot/boost/boost/boost/mpl/is_sequence.hpp,v $
sl@0
    14
// $Date: 2005/08/25 16:27:21 $
sl@0
    15
// $Revision: 1.9 $
sl@0
    16
sl@0
    17
#include <boost/mpl/not.hpp>
sl@0
    18
#include <boost/mpl/and.hpp>
sl@0
    19
#include <boost/mpl/begin_end.hpp>
sl@0
    20
#include <boost/mpl/if.hpp>
sl@0
    21
#include <boost/mpl/bool.hpp>
sl@0
    22
#include <boost/mpl/sequence_tag_fwd.hpp>
sl@0
    23
#include <boost/mpl/identity.hpp>
sl@0
    24
#include <boost/mpl/void.hpp>
sl@0
    25
#include <boost/mpl/aux_/has_tag.hpp>
sl@0
    26
#include <boost/mpl/aux_/has_begin.hpp>
sl@0
    27
#include <boost/mpl/aux_/na_spec.hpp>
sl@0
    28
#include <boost/mpl/aux_/lambda_support.hpp>
sl@0
    29
#include <boost/mpl/aux_/config/eti.hpp>
sl@0
    30
#include <boost/mpl/aux_/config/msvc.hpp>
sl@0
    31
#include <boost/mpl/aux_/config/workaround.hpp>
sl@0
    32
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
sl@0
    33
#   include <boost/mpl/aux_/msvc_is_class.hpp>
sl@0
    34
#elif BOOST_WORKAROUND(BOOST_MSVC, == 1300)
sl@0
    35
#   include <boost/type_traits/is_class.hpp>
sl@0
    36
#endif
sl@0
    37
sl@0
    38
#include <boost/type_traits/is_same.hpp>
sl@0
    39
sl@0
    40
namespace boost { namespace mpl {
sl@0
    41
sl@0
    42
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
sl@0
    43
sl@0
    44
namespace aux {
sl@0
    45
sl@0
    46
// agurt, 11/jun/03: 
sl@0
    47
// MSVC 6.5/7.0 fails if 'has_begin' is instantiated on a class type that has a
sl@0
    48
// 'begin' member that doesn't name a type; e.g. 'has_begin< std::vector<int> >'
sl@0
    49
// would fail; requiring 'T' to have _both_ 'tag' and 'begin' members workarounds
sl@0
    50
// the issue for most real-world cases
sl@0
    51
template< typename T > struct is_sequence_impl
sl@0
    52
    : and_<
sl@0
    53
          identity< aux::has_tag<T> >
sl@0
    54
        , identity< aux::has_begin<T> >
sl@0
    55
        >
sl@0
    56
{
sl@0
    57
};
sl@0
    58
sl@0
    59
} // namespace aux
sl@0
    60
        
sl@0
    61
template<
sl@0
    62
      typename BOOST_MPL_AUX_NA_PARAM(T)
sl@0
    63
    >
sl@0
    64
struct is_sequence
sl@0
    65
    : if_<
sl@0
    66
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
sl@0
    67
          aux::msvc_is_class<T> 
sl@0
    68
#else
sl@0
    69
          boost::is_class<T> 
sl@0
    70
#endif
sl@0
    71
        , aux::is_sequence_impl<T>
sl@0
    72
        , bool_<false>
sl@0
    73
        >::type
sl@0
    74
{
sl@0
    75
    BOOST_MPL_AUX_LAMBDA_SUPPORT(1, is_sequence, (T))
sl@0
    76
};
sl@0
    77
sl@0
    78
#elif defined(BOOST_MPL_CFG_NO_HAS_XXX)
sl@0
    79
sl@0
    80
template<
sl@0
    81
      typename BOOST_MPL_AUX_NA_PARAM(T)
sl@0
    82
    >
sl@0
    83
struct is_sequence
sl@0
    84
    : bool_<false>
sl@0
    85
{
sl@0
    86
};
sl@0
    87
sl@0
    88
#else
sl@0
    89
sl@0
    90
template<
sl@0
    91
      typename BOOST_MPL_AUX_NA_PARAM(T)
sl@0
    92
    >
sl@0
    93
struct is_sequence
sl@0
    94
    : not_< is_same< typename begin<T>::type, void_ > >
sl@0
    95
{
sl@0
    96
    BOOST_MPL_AUX_LAMBDA_SUPPORT(1, is_sequence, (T))
sl@0
    97
};
sl@0
    98
sl@0
    99
#endif // BOOST_MSVC
sl@0
   100
sl@0
   101
#if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG)
sl@0
   102
template<> struct is_sequence<int>
sl@0
   103
    : bool_<false>
sl@0
   104
{
sl@0
   105
};
sl@0
   106
#endif
sl@0
   107
sl@0
   108
BOOST_MPL_AUX_NA_SPEC_NO_ETI(1, is_sequence)
sl@0
   109
sl@0
   110
}}
sl@0
   111
sl@0
   112
#endif // BOOST_MPL_IS_SEQUENCE_HPP_INCLUDED