sl@0
|
1 |
// (C) Copyright Jonathan Turkanis 2003.
|
sl@0
|
2 |
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
sl@0
|
3 |
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
|
sl@0
|
4 |
|
sl@0
|
5 |
// See http://www.boost.org/libs/iostreams for documentation.
|
sl@0
|
6 |
|
sl@0
|
7 |
// Contains the metafunction select, which mimics the effect of a chain of
|
sl@0
|
8 |
// nested mpl if_'s.
|
sl@0
|
9 |
//
|
sl@0
|
10 |
// -----------------------------------------------------------------------------
|
sl@0
|
11 |
//
|
sl@0
|
12 |
// Usage:
|
sl@0
|
13 |
//
|
sl@0
|
14 |
// typedef typename select<
|
sl@0
|
15 |
// case1, type1,
|
sl@0
|
16 |
// case2, type2,
|
sl@0
|
17 |
// ...
|
sl@0
|
18 |
// true_, typen
|
sl@0
|
19 |
// >::type selection;
|
sl@0
|
20 |
//
|
sl@0
|
21 |
// Here case1, case2, ... are models of MPL::IntegralConstant with value type
|
sl@0
|
22 |
// bool, and n <= 10.
|
sl@0
|
23 |
|
sl@0
|
24 |
#ifndef BOOST_IOSTREAMS_SELECT_HPP_INCLUDED
|
sl@0
|
25 |
#define BOOST_IOSTREAMS_SELECT_HPP_INCLUDED
|
sl@0
|
26 |
|
sl@0
|
27 |
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
sl@0
|
28 |
# pragma once
|
sl@0
|
29 |
#endif
|
sl@0
|
30 |
|
sl@0
|
31 |
#include <boost/type_traits/is_base_and_derived.hpp>
|
sl@0
|
32 |
#include <boost/mpl/eval_if.hpp>
|
sl@0
|
33 |
#include <boost/mpl/identity.hpp>
|
sl@0
|
34 |
#include <boost/mpl/if.hpp>
|
sl@0
|
35 |
#include <boost/mpl/void.hpp>
|
sl@0
|
36 |
|
sl@0
|
37 |
namespace boost { namespace iostreams {
|
sl@0
|
38 |
|
sl@0
|
39 |
typedef mpl::true_ else_;
|
sl@0
|
40 |
|
sl@0
|
41 |
template< typename Case1 = mpl::true_,
|
sl@0
|
42 |
typename Type1 = mpl::void_,
|
sl@0
|
43 |
typename Case2 = mpl::true_,
|
sl@0
|
44 |
typename Type2 = mpl::void_,
|
sl@0
|
45 |
typename Case3 = mpl::true_,
|
sl@0
|
46 |
typename Type3 = mpl::void_,
|
sl@0
|
47 |
typename Case4 = mpl::true_,
|
sl@0
|
48 |
typename Type4 = mpl::void_,
|
sl@0
|
49 |
typename Case5 = mpl::true_,
|
sl@0
|
50 |
typename Type5 = mpl::void_,
|
sl@0
|
51 |
typename Case6 = mpl::true_,
|
sl@0
|
52 |
typename Type6 = mpl::void_,
|
sl@0
|
53 |
typename Case7 = mpl::true_,
|
sl@0
|
54 |
typename Type7 = mpl::void_,
|
sl@0
|
55 |
typename Case8 = mpl::true_,
|
sl@0
|
56 |
typename Type8 = mpl::void_,
|
sl@0
|
57 |
typename Case9 = mpl::true_,
|
sl@0
|
58 |
typename Type9 = mpl::void_,
|
sl@0
|
59 |
typename Case10 = mpl::true_,
|
sl@0
|
60 |
typename Type10 = mpl::void_ >
|
sl@0
|
61 |
struct select {
|
sl@0
|
62 |
typedef typename
|
sl@0
|
63 |
mpl::eval_if<
|
sl@0
|
64 |
Case1, mpl::identity<Type1>, mpl::eval_if<
|
sl@0
|
65 |
Case2, mpl::identity<Type2>, mpl::eval_if<
|
sl@0
|
66 |
Case3, mpl::identity<Type3>, mpl::eval_if<
|
sl@0
|
67 |
Case4, mpl::identity<Type4>, mpl::eval_if<
|
sl@0
|
68 |
Case5, mpl::identity<Type5>, mpl::eval_if<
|
sl@0
|
69 |
Case6, mpl::identity<Type6>, mpl::eval_if<
|
sl@0
|
70 |
Case7, mpl::identity<Type7>, mpl::eval_if<
|
sl@0
|
71 |
Case8, mpl::identity<Type8>, mpl::eval_if<
|
sl@0
|
72 |
Case9, mpl::identity<Type9>, mpl::if_<
|
sl@0
|
73 |
Case10, Type10, mpl::void_ > > > > > > > > >
|
sl@0
|
74 |
>::type type;
|
sl@0
|
75 |
};
|
sl@0
|
76 |
|
sl@0
|
77 |
} } // End namespaces iostreams, boost.
|
sl@0
|
78 |
|
sl@0
|
79 |
#endif // #ifndef BOOST_IOSTREAMS_SELECT_HPP_INCLUDED
|