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

@ -18,7 +18,7 @@ namespace boost { namespace fusion
{
template <typename Tag>
struct advance_impl;
template <>
struct advance_impl<vector_iterator_tag>
{
@ -28,8 +28,8 @@ namespace boost { namespace fusion
typedef typename Iterator::index index;
typedef typename Iterator::vector vector;
typedef vector_iterator<vector, index::value+N::value> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{

View File

@ -37,7 +37,7 @@ BOOST_FUSION_BARRIER_BEGIN
};
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename apply<Iterator>::type
call(Iterator)
{
@ -123,7 +123,7 @@ BOOST_FUSION_BARRIER_END
};
template <typename Iterator>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename apply<Iterator>::type
call(Iterator const& i0)
{

View File

@ -31,7 +31,7 @@ namespace boost { namespace fusion
typedef typename mpl::at<typename Sequence::types, N>::type element;
typedef typename detail::ref_result<element>::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& v)
{
@ -46,7 +46,7 @@ namespace boost { namespace fusion
typedef typename mpl::at<typename Sequence::types, N>::type element;
typedef typename detail::cref_result<element>::type type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence const& v)
{

View File

@ -23,11 +23,11 @@ namespace boost { namespace fusion
struct begin_impl<vector_tag>
{
template <typename Sequence>
struct apply
struct apply
{
typedef vector_iterator<Sequence, 0> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& v)
{

View File

@ -34,7 +34,7 @@ namespace boost { namespace fusion
template apply<typename result_of::begin<Sequence>::type>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence& seq)
{
return gen::call(fusion::begin(seq));

View File

@ -26,14 +26,14 @@ namespace boost { namespace fusion
struct deref_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;
typedef typename mpl::at<
typename vector::types, index>::type
element;
typedef typename
mpl::if_<
is_const<vector>
@ -42,7 +42,7 @@ namespace boost { namespace fusion
>::type
type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{

View File

@ -24,8 +24,8 @@ namespace boost { namespace fusion
{
template <typename First, typename Last>
struct apply : mpl::minus<typename Last::index, typename First::index>
{
BOOST_FUSION_GPU_ENABLED
{
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static typename mpl::minus<
typename Last::index, typename First::index>::type
call(First const&, Last const&)

View File

@ -23,12 +23,12 @@ namespace boost { namespace fusion
struct end_impl<vector_tag>
{
template <typename Sequence>
struct apply
struct apply
{
typedef typename Sequence::size size;
typedef vector_iterator<Sequence, size::value> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& v)
{

View File

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

View File

@ -25,13 +25,13 @@ namespace boost { namespace fusion
struct next_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;
typedef vector_iterator<vector, index::value+1> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{

View File

@ -25,13 +25,13 @@ namespace boost { namespace fusion
struct prior_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;
typedef vector_iterator<vector, index::value-1> type;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Iterator const& i)
{

View File

@ -23,7 +23,7 @@ namespace boost { namespace fusion
struct value_at_impl<vector_tag>
{
template <typename Sequence, typename N>
struct apply
struct apply
{
typedef typename mpl::at<typename Sequence::types, N>::type type;
};

View File

@ -23,7 +23,7 @@ namespace boost { namespace fusion
struct value_of_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;

View File

@ -26,6 +26,16 @@
#define M BOOST_PP_ITERATION()
// XXX:
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
#if M == 1
explicit
@ -40,6 +50,16 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
template <BOOST_PP_ENUM_PARAMS(M, typename U)>
// XXX:
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
#if M == 1
explicit

View File

@ -41,9 +41,11 @@
BOOST_PP_CAT(T, n)>(vec.BOOST_PP_CAT(m, n));
#define FUSION_VECTOR_MEMBER_AT_IMPL(z, n, _) \
BOOST_FUSION_GPU_ENABLED typename add_reference<T##n>::type \
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
typename add_reference<T##n>::type \
at_impl(mpl::int_<n>) { return this->m##n; } \
BOOST_FUSION_GPU_ENABLED typename add_reference<typename add_const<T##n>::type>::type \
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
typename add_reference<typename add_const<T##n>::type>::type \
at_impl(mpl::int_<n>) const { return this->m##n; }
#define FUSION_VECTOR_MEMBER_ITER_DECL_VAR(z, n, _) \
@ -59,7 +61,7 @@
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
struct BOOST_PP_CAT(vector_data, N)
{
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)()
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_DEFAULT_INIT, _) {}
@ -69,11 +71,22 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg)
, typename boost::enable_if<is_convertible<U0, T0> >::type* /*dummy*/ = 0
)
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_ARG_FWD, arg) {}
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_CAT(vector_data, N)&& other)
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_FORWARD, arg) {}
@ -82,18 +95,27 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
FUSION_HASH endif
#endif
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type arg))
: BOOST_PP_ENUM(N, FUSION_VECTOR_CTOR_INIT, arg) {}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_CAT(vector_data, N) const& other)
: BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_CTOR_INIT, _) {}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector_data, N)&
operator=(BOOST_PP_CAT(vector_data, N) const& vec)
{
@ -102,6 +124,15 @@ FUSION_HASH endif
}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
static BOOST_PP_CAT(vector_data, N)
init_from_sequence(Sequence const& seq)
@ -113,6 +144,15 @@ FUSION_HASH endif
}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
static BOOST_PP_CAT(vector_data, N)
init_from_sequence(Sequence& seq)
@ -140,9 +180,18 @@ FUSION_HASH endif
typedef random_access_traversal_tag category;
typedef mpl::int_<N> size;
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)() {}
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
#if (N == 1)
explicit
@ -158,6 +207,15 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
#if (N == 1)
explicit
@ -170,15 +228,15 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
: base_type(BOOST_PP_ENUM(N, FUSION_VECTOR_MEMBER_FORWARD, arg)) {}
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs)
: base_type(std::forward<base_type>(rhs)) {}
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N) const& rhs)
: base_type(static_cast<base_type const&>(rhs)) {}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N) const& vec)
{
@ -186,7 +244,7 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
return *this;
}
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N)&& vec)
{
@ -199,12 +257,30 @@ FUSION_HASH endif
#endif
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
: base_type(BOOST_PP_ENUM_PARAMS(N, vec.m)) {}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
Sequence const& seq
@ -216,6 +292,15 @@ FUSION_HASH endif
: base_type(base_type::init_from_sequence(seq)) {}
template <typename Sequence>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
FUSION_HASH if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
FUSION_HASH endif
#else
#if !defined(BOOST_CLANG)
BOOST_CXX14_CONSTEXPR
#endif
#endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
Sequence& seq
@ -227,7 +312,7 @@ FUSION_HASH endif
: base_type(base_type::init_from_sequence(seq)) {}
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
{
@ -236,7 +321,7 @@ FUSION_HASH endif
}
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename boost::disable_if<is_convertible<Sequence, T0>, this_type&>::type
operator=(Sequence const& seq)
{
@ -250,7 +335,7 @@ FUSION_HASH endif
BOOST_PP_REPEAT(N, FUSION_VECTOR_MEMBER_AT_IMPL, _)
template<typename I>
BOOST_FUSION_GPU_ENABLED
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename add_reference<typename mpl::at<types, I>::type>::type
at_impl(I)
{
@ -258,7 +343,7 @@ FUSION_HASH endif
}
template<typename I>
BOOST_FUSION_GPU_ENABLED
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
typename add_reference<typename add_const<typename mpl::at<types, I>::type>::type>::type
at_impl(I) const
{