]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/proto/transform/integral_c.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / proto / transform / integral_c.hpp
CommitLineData
7c673cae
FG
1///////////////////////////////////////////////////////////////////////////////
2/// \file integral_c.hpp
3/// Contains definition of the integral_c transform and friends.
4//
5// Copyright 2011 Eric Niebler. Distributed under the Boost
6// Software License, Version 1.0. (See accompanying file
7// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
9#ifndef BOOST_PROTO_TRANSFORM_INTEGRAL_C_HPP_EAN_04_28_2011
10#define BOOST_PROTO_TRANSFORM_INTEGRAL_C_HPP_EAN_04_28_2011
11
12#include <boost/proto/proto_fwd.hpp>
13#include <boost/proto/transform/impl.hpp>
14
15namespace boost { namespace proto
16{
17
18 /// \brief A PrimitiveTransform that returns a specified
19 /// integral constant
20 ///
21 template<typename T, T I>
22 struct integral_c : transform<integral_c<T, I> >
23 {
24 template<typename Expr, typename State, typename Data>
25 struct impl : transform_impl<Expr, State, Data>
26 {
27 typedef T result_type;
28
29 /// \return \c I
30 /// \throw nothrow
31 T operator()(
32 typename impl::expr_param
33 , typename impl::state_param
34 , typename impl::data_param
35 ) const
36 {
37 return I;
38 }
39 };
40 };
41
42 /// \brief A PrimitiveTransform that returns a specified
43 /// char
44 ///
45 template<char I>
46 struct char_
47 : integral_c<char, I>
48 {};
49
50 /// \brief A PrimitiveTransform that returns a specified
51 /// int
52 ///
53 template<int I>
54 struct int_
55 : integral_c<int, I>
56 {};
57
58 /// \brief A PrimitiveTransform that returns a specified
59 /// long
60 ///
61 template<long I>
62 struct long_
63 : integral_c<long, I>
64 {};
65
66 /// \brief A PrimitiveTransform that returns a specified
67 /// std::size_t
68 ///
69 template<std::size_t I>
70 struct size_t
71 : integral_c<std::size_t, I>
72 {};
73
74 /// INTERNAL ONLY
75 ///
76 template<typename T, T I>
77 struct is_callable<integral_c<T, I> >
78 : mpl::true_
79 {};
80
81 /// INTERNAL ONLY
82 ///
83 template<char I>
84 struct is_callable<char_<I> >
85 : mpl::true_
86 {};
87
88 /// INTERNAL ONLY
89 ///
90 template<int I>
91 struct is_callable<int_<I> >
92 : mpl::true_
93 {};
94
95 /// INTERNAL ONLY
96 ///
97 template<long I>
98 struct is_callable<long_<I> >
99 : mpl::true_
100 {};
101
102 /// INTERNAL ONLY
103 ///
104 template<std::size_t I>
105 struct is_callable<size_t<I> >
106 : mpl::true_
107 {};
108
109}}
110
111#endif