1 | // (C) Copyright David Abrahams 2001. |
2 | // Distributed under the Boost Software License, Version 1.0. (See |
3 | // accompanying file LICENSE_1_0.txt or copy at |
4 | // http://www.boost.org/LICENSE_1_0.txt) |
5 | // |
6 | // See http://www.boost.org for most recent version including documentation. |
7 | |
8 | // Revision History |
9 | // 09 Feb 01 Applied John Maddock's Borland patch Moving <true> |
10 | // specialization to unspecialized template (David Abrahams) |
11 | // 06 Feb 01 Created (David Abrahams) |
12 | |
13 | #ifndef SELECT_TYPE_DWA20010206_HPP |
14 | # define SELECT_TYPE_DWA20010206_HPP |
15 | |
16 | namespace boost { namespace detail { |
17 | |
18 | // Template class if_true -- select among 2 types based on a bool constant expression |
19 | // Usage: |
20 | // typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type |
21 | |
22 | // HP aCC cannot deal with missing names for template value parameters |
23 | template <bool b> struct if_true |
24 | { |
25 | template <class T, class F> |
26 | struct then { typedef T type; }; |
27 | }; |
28 | |
29 | template <> |
30 | struct if_true<false> |
31 | { |
32 | template <class T, class F> |
33 | struct then { typedef F type; }; |
34 | }; |
35 | }} |
36 | #endif // SELECT_TYPE_DWA20010206_HPP |
37 | |