More constexpr and noexcept support.

Note 1: Forwarding functions are specified as a C++14 constexpr since
std::forward is not a constexpr within C++11.

Note 2: Though I'm not sure why it doesn't compile, some declarations
are specified as a C++14 constexpr or non-constexpr.

Note 3: Boost.Tuple adaptation and TR1-based tuple implementations are
not constexpr.
This commit is contained in:
Kohei Takahashi
2015-03-03 02:21:02 +09:00
parent d7c918e36f
commit 2114bfca6c
280 changed files with 1107 additions and 935 deletions

View File

@ -49,31 +49,31 @@ namespace boost { namespace fusion
typedef Car car_type;
typedef Cdr cdr_type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons()
: car(), cdr() {}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit cons(typename detail::call_param<Car>::type in_car)
: car(in_car), cdr() {}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons(
typename detail::call_param<Car>::type in_car
, typename detail::call_param<Cdr>::type in_cdr)
: car(in_car), cdr(in_cdr) {}
template <typename Car2, typename Cdr2>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons(cons<Car2, Cdr2> const& rhs)
: car(rhs.car), cdr(rhs.cdr) {}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons(cons const& rhs)
: car(rhs.car), cdr(rhs.cdr) {}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons(
Sequence const& seq
, typename boost::enable_if<
@ -86,13 +86,13 @@ namespace boost { namespace fusion
, cdr(fusion::next(fusion::begin(seq)), mpl::true_()) {}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons(Iterator const& iter, mpl::true_ /*this_is_an_iterator*/)
: car(*iter)
, cdr(fusion::next(iter), mpl::true_()) {}
template <typename Car2, typename Cdr2>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons& operator=(cons<Car2, Cdr2> const& rhs)
{
car = rhs.car;
@ -100,7 +100,7 @@ namespace boost { namespace fusion
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons& operator=(cons const& rhs)
{
car = rhs.car;
@ -109,7 +109,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename boost::enable_if<
mpl::and_<
traits::is_sequence<Sequence>
@ -124,7 +124,7 @@ namespace boost { namespace fusion
}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void assign_from_iter(Iterator const& iter)
{
car = *iter;

View File

@ -36,8 +36,8 @@ namespace boost { namespace fusion
typename add_const<Cons>::type>
identity;
BOOST_FUSION_GPU_ENABLED
explicit cons_iterator(cons_type& in_cons)
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit cons_iterator(cons_type& in_cons) BOOST_NOEXCEPT
: cons(in_cons) {}
cons_type& cons;
@ -55,46 +55,47 @@ namespace boost { namespace fusion
typedef cons_iterator_identity<
add_const<nil_>::type>
identity;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
nil_iterator() {}
nil_iterator() BOOST_NOEXCEPT {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit nil_iterator(nil_ const&) {}
explicit nil_iterator(nil_ const&) BOOST_NOEXCEPT {}
};
template <>
struct cons_iterator<nil_> : nil_iterator
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons_iterator() {}
cons_iterator() BOOST_NOEXCEPT {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit cons_iterator(nil_ const&) {}
explicit cons_iterator(nil_ const&) BOOST_NOEXCEPT {}
};
template <>
struct cons_iterator<nil_ const> : nil_iterator
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons_iterator() {}
cons_iterator() BOOST_NOEXCEPT {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit cons_iterator(nil_ const&) {}
explicit cons_iterator(nil_ const&) BOOST_NOEXCEPT {}
};
template <>
struct cons_iterator<list<> > : nil_iterator
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons_iterator() {}
cons_iterator() BOOST_NOEXCEPT {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit cons_iterator(nil_ const&) {}
explicit cons_iterator(nil_ const&) BOOST_NOEXCEPT {}
};
template <>
struct cons_iterator<list<> const> : nil_iterator
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
cons_iterator() {}
cons_iterator() BOOST_NOEXCEPT {}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
explicit cons_iterator(nil_ const&) {}
explicit cons_iterator(nil_ const&) BOOST_NOEXCEPT {}
};
}}

View File

@ -31,7 +31,7 @@ namespace boost { namespace fusion
typedef typename build_cons::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{
@ -41,7 +41,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_list<Sequence>::type
as_list(Sequence& seq)
{
@ -49,7 +49,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::as_list<Sequence const>::type
as_list(Sequence const& seq)
{

View File

@ -107,7 +107,7 @@ namespace boost { namespace fusion
type;
template <typename Cons, int N2>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Cons& s, mpl::int_<N2>)
{
@ -115,14 +115,14 @@ namespace boost { namespace fusion
}
template <typename Cons>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Cons& s, mpl::int_<0>)
{
return s.car;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& s)
{

View File

@ -36,8 +36,8 @@ namespace boost { namespace fusion
struct apply
{
typedef cons_iterator<Sequence> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& t)
{

View File

@ -26,8 +26,8 @@ namespace boost { namespace fusion { namespace detail
struct build_cons<First, Last, true>
{
typedef nil_ type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static nil_
call(First const&, Last const&)
{
@ -38,7 +38,7 @@ namespace boost { namespace fusion { namespace detail
template <typename First, typename Last>
struct build_cons<First, Last, false>
{
typedef
typedef
build_cons<typename result_of::next<First>::type, Last>
next_build_cons;
@ -47,7 +47,7 @@ namespace boost { namespace fusion { namespace detail
, typename next_build_cons::type>
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(First const& f, Last const& l)
{

View File

@ -39,7 +39,7 @@ namespace boost { namespace fusion
typedef typename build_cons::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{

View File

@ -27,18 +27,18 @@ namespace boost { namespace fusion
struct deref_impl<cons_iterator_tag>
{
template <typename Iterator>
struct apply
struct apply
{
typedef typename Iterator::cons_type cons_type;
typedef typename cons_type::car_type value_type;
typedef typename mpl::eval_if<
is_const<cons_type>
, add_reference<typename add_const<value_type>::type>
, add_reference<value_type> >::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{

View File

@ -33,13 +33,13 @@ namespace boost { namespace fusion
struct end_impl<cons_tag>
{
template <typename Sequence>
struct apply
struct apply
{
typedef cons_iterator<
typename mpl::if_<is_const<Sequence>, nil_ const, nil_>::type>
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence&)
{

View File

@ -25,7 +25,7 @@ namespace boost { namespace fusion
struct equal_to_impl<cons_iterator_tag>
{
template <typename I1, typename I2>
struct apply
struct apply
: is_same<
typename I1::identity
, typename I2::identity

View File

@ -34,7 +34,7 @@
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
#if N == 1
explicit
#endif

View File

@ -26,7 +26,7 @@
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type arg))

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
{
typedef typename Iterator::cons_type cons_type;
typedef typename cons_type::cdr_type cdr_type;
typedef cons_iterator<
typename mpl::eval_if<
is_const<cons_type>
@ -44,8 +44,8 @@ namespace boost { namespace fusion
, mpl::identity<cdr_type>
>::type>
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{

View File

@ -22,7 +22,7 @@ namespace boost { namespace fusion { namespace detail
typedef reverse_cons<Cdr, cons<Car, State> > impl;
typedef typename impl::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(cons<Car, Cdr> const &cons, State const &state = State())
{
typedef fusion::cons<Car, State> cdr_type;
@ -35,7 +35,7 @@ namespace boost { namespace fusion { namespace detail
{
typedef State type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static State const &call(nil_ const &, State const &state = State())
{
return state;

View File

@ -26,9 +26,9 @@ namespace boost { namespace fusion
struct value_at_impl<cons_tag>
{
template <typename Sequence, typename N>
struct apply
struct apply
{
typedef typename
typedef typename
mpl::eval_if<
mpl::bool_<N::value == 0>
, mpl::identity<typename Sequence::car_type>

View File

@ -21,7 +21,7 @@ namespace boost { namespace fusion
struct value_of_impl<cons_iterator_tag>
{
template <typename Iterator>
struct apply
struct apply
{
typedef typename Iterator::cons_type cons_type;
typedef typename cons_type::car_type type;

View File

@ -50,17 +50,17 @@ namespace boost { namespace fusion
public:
typedef typename list_to_cons::type inherited_type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list()
: inherited_type() {}
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename U)>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(list<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, U)> const& rhs)
: inherited_type(rhs) {}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list(Sequence const& rhs
, typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0)
: inherited_type(rhs) {}
@ -75,7 +75,7 @@ namespace boost { namespace fusion
#include <boost/fusion/container/list/detail/list_forward_ctor.hpp>
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename U)>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
list&
operator=(list<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, U)> const& rhs)
{
@ -84,7 +84,7 @@ namespace boost { namespace fusion
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename boost::enable_if<traits::is_sequence<Sequence>, list&>::type
operator=(Sequence const& rhs)
{

View File

@ -32,16 +32,16 @@ namespace boost { namespace fusion
typedef void_ cdr_type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
nil_() {}
nil_() BOOST_NOEXCEPT {}
template <typename Iterator>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
nil_(Iterator const& /*iter*/, mpl::true_ /*this_is_an_iterator*/)
nil_(Iterator const& /*iter*/, mpl::true_ /*this_is_an_iterator*/) BOOST_NOEXCEPT
{}
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
void assign_from_iter(Iterator const& /*iter*/)
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
void assign_from_iter(Iterator const& /*iter*/) BOOST_NOEXCEPT
{
}
};