select_type.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. // Revision History
  8. // 09 Feb 01 Applied John Maddock's Borland patch Moving <true>
  9. // specialization to unspecialized template (David Abrahams)
  10. // 06 Feb 01 Created (David Abrahams)
  11. #ifndef SELECT_TYPE_DWA20010206_HPP
  12. # define SELECT_TYPE_DWA20010206_HPP
  13. namespace boost { namespace detail {
  14. // Template class if_true -- select among 2 types based on a bool constant expression
  15. // Usage:
  16. // typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
  17. // HP aCC cannot deal with missing names for template value parameters
  18. template <bool b> struct if_true
  19. {
  20. template <class T, class F>
  21. struct then { typedef T type; };
  22. };
  23. template <>
  24. struct if_true<false>
  25. {
  26. template <class T, class F>
  27. struct then { typedef F type; };
  28. };
  29. }}
  30. #endif // SELECT_TYPE_DWA20010206_HPP