1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/iostreams/detail/select.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,79 @@
1.4 +// (C) Copyright Jonathan Turkanis 2003.
1.5 +// Distributed under the Boost Software License, Version 1.0. (See accompanying
1.6 +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
1.7 +
1.8 +// See http://www.boost.org/libs/iostreams for documentation.
1.9 +
1.10 +// Contains the metafunction select, which mimics the effect of a chain of
1.11 +// nested mpl if_'s.
1.12 +//
1.13 +// -----------------------------------------------------------------------------
1.14 +//
1.15 +// Usage:
1.16 +//
1.17 +// typedef typename select<
1.18 +// case1, type1,
1.19 +// case2, type2,
1.20 +// ...
1.21 +// true_, typen
1.22 +// >::type selection;
1.23 +//
1.24 +// Here case1, case2, ... are models of MPL::IntegralConstant with value type
1.25 +// bool, and n <= 10.
1.26 +
1.27 +#ifndef BOOST_IOSTREAMS_SELECT_HPP_INCLUDED
1.28 +#define BOOST_IOSTREAMS_SELECT_HPP_INCLUDED
1.29 +
1.30 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
1.31 +# pragma once
1.32 +#endif
1.33 +
1.34 +#include <boost/type_traits/is_base_and_derived.hpp>
1.35 +#include <boost/mpl/eval_if.hpp>
1.36 +#include <boost/mpl/identity.hpp>
1.37 +#include <boost/mpl/if.hpp>
1.38 +#include <boost/mpl/void.hpp>
1.39 +
1.40 +namespace boost { namespace iostreams {
1.41 +
1.42 +typedef mpl::true_ else_;
1.43 +
1.44 +template< typename Case1 = mpl::true_,
1.45 + typename Type1 = mpl::void_,
1.46 + typename Case2 = mpl::true_,
1.47 + typename Type2 = mpl::void_,
1.48 + typename Case3 = mpl::true_,
1.49 + typename Type3 = mpl::void_,
1.50 + typename Case4 = mpl::true_,
1.51 + typename Type4 = mpl::void_,
1.52 + typename Case5 = mpl::true_,
1.53 + typename Type5 = mpl::void_,
1.54 + typename Case6 = mpl::true_,
1.55 + typename Type6 = mpl::void_,
1.56 + typename Case7 = mpl::true_,
1.57 + typename Type7 = mpl::void_,
1.58 + typename Case8 = mpl::true_,
1.59 + typename Type8 = mpl::void_,
1.60 + typename Case9 = mpl::true_,
1.61 + typename Type9 = mpl::void_,
1.62 + typename Case10 = mpl::true_,
1.63 + typename Type10 = mpl::void_ >
1.64 +struct select {
1.65 + typedef typename
1.66 + mpl::eval_if<
1.67 + Case1, mpl::identity<Type1>, mpl::eval_if<
1.68 + Case2, mpl::identity<Type2>, mpl::eval_if<
1.69 + Case3, mpl::identity<Type3>, mpl::eval_if<
1.70 + Case4, mpl::identity<Type4>, mpl::eval_if<
1.71 + Case5, mpl::identity<Type5>, mpl::eval_if<
1.72 + Case6, mpl::identity<Type6>, mpl::eval_if<
1.73 + Case7, mpl::identity<Type7>, mpl::eval_if<
1.74 + Case8, mpl::identity<Type8>, mpl::eval_if<
1.75 + Case9, mpl::identity<Type9>, mpl::if_<
1.76 + Case10, Type10, mpl::void_ > > > > > > > > >
1.77 + >::type type;
1.78 +};
1.79 +
1.80 +} } // End namespaces iostreams, boost.
1.81 +
1.82 +#endif // #ifndef BOOST_IOSTREAMS_SELECT_HPP_INCLUDED