update boost on linux
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
Defines `boost::hana::detail::index_if`.
|
||||
|
||||
@copyright Louis Dionne 2013-2017
|
||||
@copyright Jason Rice 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
@@ -11,61 +12,44 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
#define BOOST_HANA_DETAIL_INDEX_IF_HPP
|
||||
|
||||
#include <boost/hana/config.hpp>
|
||||
#include <boost/hana/core/when.hpp>
|
||||
#include <boost/hana/detail/decay.hpp>
|
||||
#include <boost/hana/integral_constant.hpp>
|
||||
#include <boost/hana/optional.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
|
||||
BOOST_HANA_NAMESPACE_BEGIN namespace detail {
|
||||
template <typename ...T>
|
||||
struct pack {
|
||||
static constexpr std::size_t length = sizeof...(T);
|
||||
template <std::size_t i, std::size_t N, bool Done>
|
||||
struct index_if_helper;
|
||||
|
||||
template <std::size_t i, std::size_t N>
|
||||
struct index_if_helper<i, N, false> {
|
||||
template <typename Pred, typename X1, typename ...Xs>
|
||||
using f = typename index_if_helper<i + 1, N,
|
||||
static_cast<bool>(detail::decay<decltype(
|
||||
std::declval<Pred>()(std::declval<X1>()))>::type::value)
|
||||
>::template f<Pred, Xs...>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct make_pack;
|
||||
|
||||
template <template <typename...> class Template, typename ...T>
|
||||
struct make_pack<Template<T...>> {
|
||||
using type = pack<T...>;
|
||||
template <std::size_t N>
|
||||
struct index_if_helper<N, N, false> {
|
||||
template <typename ...>
|
||||
using f = hana::optional<>;
|
||||
};
|
||||
|
||||
template <typename T> struct make_pack<T const> : make_pack<T> { };
|
||||
template <typename T> struct make_pack<T&> : make_pack<T> { };
|
||||
template <typename T> struct make_pack<T&&> : make_pack<T> { };
|
||||
|
||||
|
||||
//! @ingroup group-details
|
||||
//! Returns the index of the first element of the `pack<>` that satisfies
|
||||
//! the predicate, or the size of the pack if there is no such element.
|
||||
//!
|
||||
//! @note
|
||||
//! The predicate must return an `IntegralConstant` that can be explicitly
|
||||
//! converted to `bool`.
|
||||
template <typename Pred, typename Ts, typename = when<true>>
|
||||
struct index_if;
|
||||
|
||||
//! @cond
|
||||
template <typename Pred, typename T, typename ...Ts>
|
||||
struct index_if<Pred, pack<T, Ts...>, when<static_cast<bool>(decltype(
|
||||
std::declval<Pred>()(std::declval<T>())
|
||||
)::value)>> {
|
||||
static constexpr std::size_t value = 0;
|
||||
template <std::size_t i, std::size_t N>
|
||||
struct index_if_helper<i, N, true> {
|
||||
template <typename ...>
|
||||
using f = hana::optional<hana::size_t<i - 1>>;
|
||||
};
|
||||
|
||||
template <typename Pred, typename T, typename ...Ts>
|
||||
struct index_if<Pred, pack<T, Ts...>, when<!static_cast<bool>(decltype(
|
||||
std::declval<Pred>()(std::declval<T>())
|
||||
)::value)>> {
|
||||
static constexpr std::size_t value = 1 + index_if<Pred, pack<Ts...>>::value;
|
||||
template <typename Pred, typename ...Xs>
|
||||
struct index_if {
|
||||
using type = typename index_if_helper<0, sizeof...(Xs), false>
|
||||
::template f<Pred, Xs...>;
|
||||
};
|
||||
|
||||
template <typename Pred>
|
||||
struct index_if<Pred, pack<>> {
|
||||
static constexpr std::size_t value = 0;
|
||||
};
|
||||
//! @endcond
|
||||
} BOOST_HANA_NAMESPACE_END
|
||||
|
||||
#endif // !BOOST_HANA_DETAIL_INDEX_IF_HPP
|
||||
|
||||
@@ -10,16 +10,6 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
#ifndef BOOST_HANA_DETAIL_PREPROCESSOR_HPP
|
||||
#define BOOST_HANA_DETAIL_PREPROCESSOR_HPP
|
||||
|
||||
//! @ingroup group-details
|
||||
//! Macro expanding to the number of arguments it is passed.
|
||||
//!
|
||||
//! Specifically, `BOOST_HANA_PP_NARG(x1, ..., xn)` expands to `n`.
|
||||
//! It is undefined behavior if `n > 64` or if `n == 0`.
|
||||
#define BOOST_HANA_PP_NARG(...) \
|
||||
BOOST_HANA_PP_NARG_IMPL(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,)
|
||||
|
||||
#define BOOST_HANA_PP_NARG_IMPL(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63, N, ...) N
|
||||
|
||||
//! @ingroup group-details
|
||||
//! Expands to the concatenation of its two arguments.
|
||||
#define BOOST_HANA_PP_CONCAT(x, y) BOOST_HANA_PP_CONCAT_PRIMITIVE(x, y)
|
||||
@@ -30,68 +20,6 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
#define BOOST_HANA_PP_STRINGIZE(...) BOOST_HANA_PP_STRINGIZE_PRIMITIVE(__VA_ARGS__)
|
||||
#define BOOST_HANA_PP_STRINGIZE_PRIMITIVE(...) #__VA_ARGS__
|
||||
|
||||
//! @ingroup group-details
|
||||
//! Expands to its last argument.
|
||||
//!
|
||||
//! This macro can be passed up to 20 arguments.
|
||||
#define BOOST_HANA_PP_BACK(...) \
|
||||
BOOST_HANA_PP_BACK_IMPL(BOOST_HANA_PP_NARG(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
#define BOOST_HANA_PP_BACK_IMPL(N, ...) \
|
||||
BOOST_HANA_PP_CONCAT(BOOST_HANA_PP_BACK_IMPL_, N)(__VA_ARGS__)
|
||||
|
||||
#define BOOST_HANA_PP_BACK_IMPL_1(e0) e0
|
||||
#define BOOST_HANA_PP_BACK_IMPL_2(e0, e1) e1
|
||||
#define BOOST_HANA_PP_BACK_IMPL_3(e0, e1, e2) e2
|
||||
#define BOOST_HANA_PP_BACK_IMPL_4(e0, e1, e2, e3) e3
|
||||
#define BOOST_HANA_PP_BACK_IMPL_5(e0, e1, e2, e3, e4) e4
|
||||
#define BOOST_HANA_PP_BACK_IMPL_6(e0, e1, e2, e3, e4, e5) e5
|
||||
#define BOOST_HANA_PP_BACK_IMPL_7(e0, e1, e2, e3, e4, e5, e6) e6
|
||||
#define BOOST_HANA_PP_BACK_IMPL_8(e0, e1, e2, e3, e4, e5, e6, e7) e7
|
||||
#define BOOST_HANA_PP_BACK_IMPL_9(e0, e1, e2, e3, e4, e5, e6, e7, e8) e8
|
||||
#define BOOST_HANA_PP_BACK_IMPL_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) e9
|
||||
#define BOOST_HANA_PP_BACK_IMPL_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) e10
|
||||
#define BOOST_HANA_PP_BACK_IMPL_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11) e11
|
||||
#define BOOST_HANA_PP_BACK_IMPL_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12) e12
|
||||
#define BOOST_HANA_PP_BACK_IMPL_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) e13
|
||||
#define BOOST_HANA_PP_BACK_IMPL_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14) e14
|
||||
#define BOOST_HANA_PP_BACK_IMPL_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15) e15
|
||||
#define BOOST_HANA_PP_BACK_IMPL_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16) e16
|
||||
#define BOOST_HANA_PP_BACK_IMPL_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17) e17
|
||||
#define BOOST_HANA_PP_BACK_IMPL_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18) e18
|
||||
#define BOOST_HANA_PP_BACK_IMPL_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19) e19
|
||||
|
||||
//! @ingroup group-details
|
||||
//! Expands to all of its arguments, except for the last one.
|
||||
//!
|
||||
//! This macro can be given up to 20 arguments.
|
||||
#define BOOST_HANA_PP_DROP_BACK(...) \
|
||||
BOOST_HANA_PP_DROP_BACK_IMPL(BOOST_HANA_PP_NARG(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL(N, ...) \
|
||||
BOOST_HANA_PP_CONCAT(BOOST_HANA_PP_DROP_BACK_IMPL_, N)(__VA_ARGS__)
|
||||
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_1(e0)
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_2(e0, e1) e0
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_3(e0, e1, e2) e0, e1
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_4(e0, e1, e2, e3) e0, e1, e2
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_5(e0, e1, e2, e3, e4) e0, e1, e2, e3
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_6(e0, e1, e2, e3, e4, e5) e0, e1, e2, e3, e4
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_7(e0, e1, e2, e3, e4, e5, e6) e0, e1, e2, e3, e4, e5
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_8(e0, e1, e2, e3, e4, e5, e6, e7) e0, e1, e2, e3, e4, e5, e6
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_9(e0, e1, e2, e3, e4, e5, e6, e7, e8) e0, e1, e2, e3, e4, e5, e6, e7
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) e0, e1, e2, e3, e4, e5, e6, e7, e8
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17
|
||||
#define BOOST_HANA_PP_DROP_BACK_IMPL_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18
|
||||
|
||||
//! @ingroup group-details
|
||||
//! Expands to its first argument.
|
||||
#define BOOST_HANA_PP_FRONT(...) BOOST_HANA_PP_FRONT_IMPL(__VA_ARGS__, )
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
<%#
|
||||
This is an ERB [1] template file used to generate the
|
||||
<boost/hana/detail/struct_macros.hpp> header. The maximum
|
||||
number of members that can be handled by the macros can
|
||||
be controlled with the 'MAX_NUMBER_OF_MEMBERS' variable,
|
||||
which can be set when calling ERB to generate the header:
|
||||
|
||||
export MAX_NUMBER_OF_MEMBERS=55; erb struct_macros.erb.hpp
|
||||
|
||||
'MAX_NUMBER_OF_MEMBERS' must be <= 62, otherwise an error is triggered.
|
||||
In case 'MAX_NUMBER_OF_MEMBERS' is not specified, it defaults to 40.
|
||||
|
||||
[1]: http://en.wikipedia.org/wiki/ERuby
|
||||
%>
|
||||
|
||||
<%
|
||||
MAX_NUMBER_OF_MEMBERS = (ENV["MAX_NUMBER_OF_MEMBERS"] || 40).to_i
|
||||
raise "MAX_NUMBER_OF_MEMBERS must be <= 62" if MAX_NUMBER_OF_MEMBERS > 62
|
||||
%>
|
||||
|
||||
/*!
|
||||
@file
|
||||
Defines the `BOOST_HANA_DEFINE_STRUCT`, `BOOST_HANA_ADAPT_STRUCT`, and
|
||||
`BOOST_HANA_ADAPT_ADT` macros.
|
||||
|
||||
@copyright Louis Dionne 2013-2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS GENERATED FROM THE <boost/hana/detail/struct_macros.erb.hpp>
|
||||
// ERB TEMPLATE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
//
|
||||
// THE ERB TEMPLATE CONTAINS INFORMATION ABOUT HOW TO REGENERATE THIS FILE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_HANA_DETAIL_STRUCT_MACROS_HPP
|
||||
#define BOOST_HANA_DETAIL_STRUCT_MACROS_HPP
|
||||
|
||||
#include <boost/hana/config.hpp>
|
||||
#include <boost/hana/detail/preprocessor.hpp>
|
||||
#include <boost/hana/pair.hpp>
|
||||
#include <boost/hana/string.hpp>
|
||||
#include <boost/hana/tuple.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
|
||||
BOOST_HANA_NAMESPACE_BEGIN namespace struct_detail {
|
||||
template <typename Memptr, Memptr ptr>
|
||||
struct member_ptr {
|
||||
template <typename T>
|
||||
constexpr decltype(auto) operator()(T&& t) const
|
||||
{ return static_cast<T&&>(t).*ptr; }
|
||||
};
|
||||
|
||||
constexpr std::size_t strlen(char const* s) {
|
||||
std::size_t n = 0;
|
||||
while (*s++ != '\0')
|
||||
++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
template <std::size_t n, typename Names, std::size_t ...i>
|
||||
constexpr auto prepare_member_name_impl(std::index_sequence<i...>) {
|
||||
return hana::string_c<hana::at_c<n>(Names::get())[i]...>;
|
||||
}
|
||||
|
||||
template <std::size_t n, typename Names>
|
||||
constexpr auto prepare_member_name() {
|
||||
constexpr std::size_t len = strlen(hana::at_c<n>(Names::get()));
|
||||
return prepare_member_name_impl<n, Names>(std::make_index_sequence<len>{});
|
||||
}
|
||||
} BOOST_HANA_NAMESPACE_END
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// BOOST_HANA_ADAPT_STRUCT
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename ...>
|
||||
struct BOOST_HANA_ADAPT_STRUCT_must_be_called_in_the_global_namespace;
|
||||
|
||||
#define BOOST_HANA_ADAPT_STRUCT(...) \
|
||||
template <> \
|
||||
struct BOOST_HANA_ADAPT_STRUCT_must_be_called_in_the_global_namespace<>; \
|
||||
BOOST_HANA_ADAPT_STRUCT_IMPL(BOOST_HANA_PP_NARG(__VA_ARGS__), __VA_ARGS__)\
|
||||
static_assert(true, "force the usage of a trailing semicolon") \
|
||||
/**/
|
||||
|
||||
#define BOOST_HANA_ADAPT_STRUCT_IMPL(N, ...) \
|
||||
BOOST_HANA_PP_CONCAT(BOOST_HANA_ADAPT_STRUCT_IMPL_, N)(__VA_ARGS__)
|
||||
|
||||
<% (0..MAX_NUMBER_OF_MEMBERS).each do |n| %>
|
||||
#define BOOST_HANA_ADAPT_STRUCT_IMPL_<%= n+1 %>(TYPE <%= (1..n).map { |i| ", m#{i}" }.join %>) \
|
||||
namespace boost { namespace hana { \
|
||||
template <> \
|
||||
struct accessors_impl<TYPE> { \
|
||||
static constexpr auto apply() { \
|
||||
struct member_names { \
|
||||
static constexpr auto get() { \
|
||||
return ::boost::hana::make_tuple( \
|
||||
<%= (1..n).map { |i| "BOOST_HANA_PP_STRINGIZE(m#{i})" }.join(', ') %> \
|
||||
); \
|
||||
} \
|
||||
}; \
|
||||
return ::boost::hana::make_tuple( \
|
||||
<%= (1..n).map { |i| "::boost::hana::make_pair(::boost::hana::struct_detail::prepare_member_name<#{i-1}, member_names>(), ::boost::hana::struct_detail::member_ptr<decltype(&TYPE::m#{i}), &TYPE::m#{i}>{})" }.join(', ') %>\
|
||||
); \
|
||||
} \
|
||||
}; \
|
||||
}} \
|
||||
/**/
|
||||
<% end %>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// BOOST_HANA_ADAPT_ADT
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename ...>
|
||||
struct BOOST_HANA_ADAPT_ADT_must_be_called_in_the_global_namespace;
|
||||
|
||||
#define BOOST_HANA_ADAPT_ADT(...) \
|
||||
template <> \
|
||||
struct BOOST_HANA_ADAPT_ADT_must_be_called_in_the_global_namespace<>; \
|
||||
BOOST_HANA_ADAPT_ADT_IMPL(BOOST_HANA_PP_NARG(__VA_ARGS__), __VA_ARGS__) \
|
||||
static_assert(true, "force the usage of a trailing semicolon") \
|
||||
/**/
|
||||
|
||||
#define BOOST_HANA_ADAPT_ADT_IMPL(N, ...) \
|
||||
BOOST_HANA_PP_CONCAT(BOOST_HANA_ADAPT_ADT_IMPL_, N)(__VA_ARGS__)
|
||||
|
||||
<% (0..MAX_NUMBER_OF_MEMBERS).each do |n| %>
|
||||
#define BOOST_HANA_ADAPT_ADT_IMPL_<%= n+1 %>(TYPE <%= (1..n).map { |i| ", m#{i}" }.join %>) \
|
||||
namespace boost { namespace hana { \
|
||||
template <> \
|
||||
struct accessors_impl<TYPE> { \
|
||||
template <typename ...> \
|
||||
static constexpr auto apply() { \
|
||||
struct member_names { \
|
||||
static constexpr auto get() { \
|
||||
return ::boost::hana::make_tuple( \
|
||||
<%= (1..n).map { |i| "BOOST_HANA_PP_STRINGIZE(BOOST_HANA_PP_FRONT m#{i})" }.join(', ') %>\
|
||||
); \
|
||||
} \
|
||||
}; \
|
||||
return ::boost::hana::make_tuple( \
|
||||
<%= (1..n).map { |i| "::boost::hana::make_pair(::boost::hana::struct_detail::prepare_member_name<#{i-1}, member_names>(), BOOST_HANA_PP_DROP_FRONT m#{i})" }.join(', ') %>\
|
||||
); \
|
||||
} \
|
||||
}; \
|
||||
}} \
|
||||
/**/
|
||||
<% end %>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// BOOST_HANA_DEFINE_STRUCT
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#define BOOST_HANA_DEFINE_STRUCT(...) \
|
||||
BOOST_HANA_DEFINE_STRUCT_IMPL(BOOST_HANA_PP_NARG(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
#define BOOST_HANA_DEFINE_STRUCT_IMPL(N, ...) \
|
||||
BOOST_HANA_PP_CONCAT(BOOST_HANA_DEFINE_STRUCT_IMPL_, N)(__VA_ARGS__)
|
||||
|
||||
<% (0..MAX_NUMBER_OF_MEMBERS).each do |n| %>
|
||||
#define BOOST_HANA_DEFINE_STRUCT_IMPL_<%= n+1 %>(TYPE <%= (1..n).map { |i| ", m#{i}" }.join %>) \
|
||||
<%= (1..n).map { |i| "BOOST_HANA_PP_DROP_BACK m#{i} BOOST_HANA_PP_BACK m#{i};" }.join(' ') %> \
|
||||
\
|
||||
struct hana_accessors_impl { \
|
||||
static constexpr auto apply() { \
|
||||
struct member_names { \
|
||||
static constexpr auto get() { \
|
||||
return ::boost::hana::make_tuple( \
|
||||
<%= (1..n).map { |i| "BOOST_HANA_PP_STRINGIZE(BOOST_HANA_PP_BACK m#{i})" }.join(', ') %>\
|
||||
); \
|
||||
} \
|
||||
}; \
|
||||
return ::boost::hana::make_tuple( \
|
||||
<%= (1..n).map { |i| "::boost::hana::make_pair(::boost::hana::struct_detail::prepare_member_name<#{i-1}, member_names>(), ::boost::hana::struct_detail::member_ptr<decltype(&TYPE::BOOST_HANA_PP_BACK m#{i}), &TYPE::BOOST_HANA_PP_BACK m#{i}>{})" }.join(', ') %>\
|
||||
); \
|
||||
} \
|
||||
} \
|
||||
/**/
|
||||
<% end %>
|
||||
|
||||
#endif // !BOOST_HANA_DETAIL_STRUCT_MACROS_HPP
|
||||
File diff suppressed because one or more lines are too long
@@ -25,7 +25,7 @@ BOOST_HANA_NAMESPACE_BEGIN namespace detail {
|
||||
template <std::size_t ...Lengths>
|
||||
struct flatten_indices {
|
||||
// avoid empty arrays by appending 0 to `lengths`
|
||||
static constexpr std::size_t lengths[] = {Lengths..., 0};
|
||||
static constexpr std::size_t lengths[sizeof...(Lengths) + 1] = {Lengths..., 0};
|
||||
static constexpr auto flat_length =
|
||||
detail::accumulate(lengths, lengths + sizeof...(Lengths), 0);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
|
||||
BOOST_HANA_NAMESPACE_BEGIN namespace detail { namespace variadic {
|
||||
//! @cond
|
||||
template <unsigned int n, typename = when<true>>
|
||||
struct foldl1_impl;
|
||||
|
||||
@@ -195,6 +196,7 @@ BOOST_HANA_NAMESPACE_BEGIN namespace detail { namespace variadic {
|
||||
, static_cast<Xn&&>(xn)...);
|
||||
}
|
||||
};
|
||||
//! @endcond
|
||||
|
||||
struct foldl1_t {
|
||||
template <typename F, typename X1, typename ...Xn>
|
||||
|
||||
@@ -15,6 +15,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
|
||||
BOOST_HANA_NAMESPACE_BEGIN namespace detail { namespace variadic {
|
||||
//! @cond
|
||||
template <unsigned int n, typename = when<true>>
|
||||
struct foldr1_impl;
|
||||
|
||||
@@ -181,6 +182,7 @@ BOOST_HANA_NAMESPACE_BEGIN namespace detail { namespace variadic {
|
||||
foldr1_impl<sizeof...(xn) + 1>::apply(f, static_cast<X56&&>(x56), static_cast<Xn&&>(xn)...))))))))))))))))))))))))))))))))))))))))))))))))))))))));
|
||||
}
|
||||
};
|
||||
//! @endcond
|
||||
|
||||
struct foldr1_t {
|
||||
template <typename F, typename X1, typename ...Xn>
|
||||
|
||||
Reference in New Issue
Block a user