blob: 78b90506df777aa8afcf0a9f39efccc1f1abed60 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001// (C) Copyright John Maddock 2005.
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
Jeff Thompson3d613fd2013-10-15 15:39:04 -07006#ifndef NDNBOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
7#define NDNBOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
Jeff Thompsonf7d49942013-08-01 16:47:40 -07008
Jeff Thompson2277ce52013-08-01 17:34:11 -07009#include <ndnboost/config.hpp>
10#include <ndnboost/mpl/bool.hpp>
11#include <ndnboost/mpl/integral_c.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070012
13namespace ndnboost{
14
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015#if defined(NDNBOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) || defined(__BORLANDC__)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070016template <class T, int val>
17#else
18template <class T, T val>
19#endif
20struct integral_constant : public mpl::integral_c<T, val>
21{
22 typedef integral_constant<T,val> type;
23};
24
25template<> struct integral_constant<bool,true> : public mpl::true_
26{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070027#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070028# pragma warning(push)
29# pragma warning(disable:4097)
30 typedef mpl::true_ base_;
31 using base_::value;
32# pragma warning(pop)
33#endif
34 typedef integral_constant<bool,true> type;
35};
36template<> struct integral_constant<bool,false> : public mpl::false_
37{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070038#if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070039# pragma warning(push)
40# pragma warning(disable:4097)
41 typedef mpl::false_ base_;
42 using base_::value;
43# pragma warning(pop)
44#endif
45 typedef integral_constant<bool,false> type;
46};
47
48typedef integral_constant<bool,true> true_type;
49typedef integral_constant<bool,false> false_type;
50
51}
52
53#endif