mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-19 04:22:13 +00:00
Make static_assert messages more visible
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -19,9 +19,9 @@ template <class T, class U>
|
||||
constexpr void static_assert_layout_compatible() noexcept {
|
||||
static_assert(
|
||||
std::alignment_of<T>::value == std::alignment_of<U>::value,
|
||||
"Alignment check failed, probably your structure has user-defined alignment for the whole structure or for some of the fields."
|
||||
"====================> Boost.PFR: Alignment check failed, probably your structure has user-defined alignment for the whole structure or for some of the fields."
|
||||
);
|
||||
static_assert(sizeof(T) == sizeof(U), "Size check failed, probably your structure has bitfields or user-defined alignment.");
|
||||
static_assert(sizeof(T) == sizeof(U), "====================> Boost.PFR: Size check failed, probably your structure has bitfields or user-defined alignment.");
|
||||
}
|
||||
|
||||
/// @cond
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -94,7 +94,7 @@ constexpr std::size_t type_to_id_extension_apply(std::size_t ext) noexcept {
|
||||
constexpr std::size_t extensions = (Unptr & ~native_types_mask);
|
||||
static_assert(
|
||||
!((extensions >> bits_per_extension) & native_types_mask),
|
||||
"Too many extensions for a single field (something close to `int************************** p;` is in the POD type)."
|
||||
"====================> Boost.PFR: Too many extensions for a single field (something close to `int************************** p;` is in the POD type)."
|
||||
);
|
||||
|
||||
return (extensions >> bits_per_extension) | native_id | ext;
|
||||
@@ -176,7 +176,7 @@ constexpr std::size_t type_to_id(identity<Type*>) noexcept {
|
||||
constexpr auto unptr = type_to_id(identity<Type>{});
|
||||
static_assert(
|
||||
std::is_same<const std::size_t, decltype(unptr)>::value,
|
||||
"Pointers to user defined types are not supported."
|
||||
"====================> Boost.PFR: Pointers to user defined types are not supported."
|
||||
);
|
||||
return type_to_id_extension_apply<unptr>(native_ptr_type);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ constexpr std::size_t type_to_id(identity<const Type*>) noexcept {
|
||||
constexpr auto unptr = type_to_id(identity<Type>{});
|
||||
static_assert(
|
||||
std::is_same<const std::size_t, decltype(unptr)>::value,
|
||||
"Const pointers to user defined types are not supported."
|
||||
"====================> Boost.PFR: Const pointers to user defined types are not supported."
|
||||
);
|
||||
return type_to_id_extension_apply<unptr>(native_const_ptr_type);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ constexpr std::size_t type_to_id(identity<const volatile Type*>) noexcept {
|
||||
constexpr auto unptr = type_to_id(identity<Type>{});
|
||||
static_assert(
|
||||
std::is_same<const std::size_t, decltype(unptr)>::value,
|
||||
"Const volatile pointers to user defined types are not supported."
|
||||
"====================> Boost.PFR: Const volatile pointers to user defined types are not supported."
|
||||
);
|
||||
return type_to_id_extension_apply<unptr>(native_const_volatile_ptr_type);
|
||||
}
|
||||
@@ -206,7 +206,7 @@ constexpr std::size_t type_to_id(identity<volatile Type*>) noexcept {
|
||||
constexpr auto unptr = type_to_id(identity<Type>{});
|
||||
static_assert(
|
||||
std::is_same<const std::size_t, decltype(unptr)>::value,
|
||||
"Volatile pointers to user defined types are not supported."
|
||||
"====================> Boost.PFR: Volatile pointers to user defined types are not supported."
|
||||
);
|
||||
return type_to_id_extension_apply<unptr>(native_volatile_ptr_type);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ constexpr std::size_t type_to_id(identity<Type&>) noexcept {
|
||||
constexpr auto unptr = type_to_id(identity<Type>{});
|
||||
static_assert(
|
||||
std::is_same<const std::size_t, decltype(unptr)>::value,
|
||||
"References to user defined types are not supported."
|
||||
"====================> Boost.PFR: References to user defined types are not supported."
|
||||
);
|
||||
return type_to_id_extension_apply<unptr>(native_ref_type);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ constexpr std::size_t type_to_id(identity<Type>, std::enable_if_t<std::is_enum<T
|
||||
|
||||
template <class Type>
|
||||
constexpr std::size_t type_to_id(identity<Type>, std::enable_if_t<std::is_empty<Type>::value>*) noexcept {
|
||||
static_assert(!std::is_empty<Type>::value, "Empty classes/structures as members are not supported.");
|
||||
static_assert(!std::is_empty<Type>::value, "====================> Boost.PFR: Empty classes/structures as members are not supported.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ template <class Type>
|
||||
constexpr std::size_t type_to_id(identity<Type>, std::enable_if_t<std::is_union<Type>::value>*) noexcept {
|
||||
static_assert(
|
||||
!std::is_union<Type>::value,
|
||||
"For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ constexpr auto id_to_type(size_t_<Index >, if_extension<Index, native_volatile_p
|
||||
|
||||
template <std::size_t Index>
|
||||
constexpr auto id_to_type(size_t_<Index >, if_extension<Index, native_ref_type>) noexcept {
|
||||
static_assert(!Index, "References are not supported");
|
||||
static_assert(!Index, "====================> Boost.PFR: References are not supported");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ constexpr auto flat_type_to_array_of_type_ids(std::size_t* types, std::index_seq
|
||||
{
|
||||
static_assert(
|
||||
N <= sizeof(T),
|
||||
"Bit fields are not supported."
|
||||
"====================> Boost.PFR: Bit fields are not supported."
|
||||
);
|
||||
|
||||
constexpr auto offsets = get_type_offsets<T, N, I...>();
|
||||
@@ -405,19 +405,19 @@ constexpr auto increment_index_sequence(std::index_sequence<I...>) noexcept {
|
||||
|
||||
template <class T, std::size_t V, std::size_t I, std::size_t SubtupleLength>
|
||||
constexpr auto prepare_subtuples(size_t_<V>, size_t_<I>, size_t_<SubtupleLength>) noexcept {
|
||||
static_assert(SubtupleLength == 0, "Internal error while representing nested field as tuple");
|
||||
static_assert(SubtupleLength == 0, "====================> Boost.PFR: Internal error while representing nested field as tuple");
|
||||
return typeid_conversions::id_to_type(size_t_<V>{});
|
||||
}
|
||||
|
||||
template <class T, std::size_t I, std::size_t SubtupleLength>
|
||||
constexpr auto prepare_subtuples(size_t_<typeid_conversions::tuple_end_tag>, size_t_<I>, size_t_<SubtupleLength>) noexcept {
|
||||
static_assert(sizeof(T) == 0, "Internal error while representing nested field as tuple");
|
||||
static_assert(sizeof(T) == 0, "====================> Boost.PFR: Internal error while representing nested field as tuple");
|
||||
return int{};
|
||||
}
|
||||
|
||||
template <class T, std::size_t I, std::size_t SubtupleLength>
|
||||
constexpr auto prepare_subtuples(size_t_<typeid_conversions::tuple_begin_tag>, size_t_<I>, size_t_<SubtupleLength>) noexcept {
|
||||
static_assert(SubtupleLength > 2, "Internal error while representing nested field as tuple");
|
||||
static_assert(SubtupleLength > 2, "====================> Boost.PFR: Internal error while representing nested field as tuple");
|
||||
constexpr auto seq = std::make_index_sequence<SubtupleLength - 2>{};
|
||||
return as_flat_tuple_impl<T>( increment_index_sequence<I + 1>(seq) );
|
||||
}
|
||||
@@ -505,8 +505,8 @@ template <class T>
|
||||
constexpr auto internal_tuple_with_same_alignment() noexcept {
|
||||
typedef typename std::remove_cv<T>::type type;
|
||||
|
||||
static_assert(std::is_pod<type>::value, "Type can not be used is flat_ functions, because it's not POD");
|
||||
static_assert(!std::is_reference<type>::value, "Not applyable");
|
||||
static_assert(std::is_pod<type>::value, "====================> Boost.PFR: Type can not be used is flat_ functions, because it's not POD");
|
||||
static_assert(!std::is_reference<type>::value, "====================> Boost.PFR: Not applyable");
|
||||
constexpr auto res = as_flat_tuple_impl<type>(
|
||||
std::make_index_sequence< decltype(flat_array_of_type_ids<type>())::size() >()
|
||||
);
|
||||
@@ -549,7 +549,7 @@ template <class T>
|
||||
auto tie_as_flat_tuple(T& lvalue) noexcept {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
using type = std::remove_cv_t<T>;
|
||||
using tuple_type = internal_tuple_with_same_alignment_t<type>;
|
||||
@@ -564,11 +564,11 @@ template <class T>
|
||||
auto tie_as_tuple(T& val) noexcept {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
static_assert(
|
||||
boost::pfr::detail::is_flat_refelectable<T>( std::make_index_sequence<boost::pfr::detail::fields_count<T>()>{} ),
|
||||
"Not possible in C++14 to represent that type without loosing information. Use boost::pfr::flat_ version, or change type definition, or enable C++17"
|
||||
"====================> Boost.PFR: Not possible in C++14 to represent that type without loosing information. Use boost::pfr::flat_ version, or change type definition, or enable C++17"
|
||||
);
|
||||
return boost::pfr::detail::tie_as_flat_tuple(val);
|
||||
}
|
||||
@@ -585,7 +585,7 @@ struct ubiq_constructor_constexpr_copy {
|
||||
constexpr operator Type() const noexcept {
|
||||
static_assert(
|
||||
std::is_trivially_destructible<Type>::value,
|
||||
"One of the fields in the type passed to `for_each_field` has non trivial destructor."
|
||||
"====================> Boost.PFR: One of the fields in the type passed to `for_each_field` has non trivial destructor."
|
||||
);
|
||||
return {};
|
||||
}
|
||||
@@ -671,7 +671,7 @@ template <class T, class F, std::size_t... I>
|
||||
void for_each_field_dispatcher(T& t, F&& f, std::index_sequence<I...>) {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
|
||||
/// Compile time error at this point means that you have called `for_each_field` or some other non-flat function or operator for a
|
||||
@@ -682,7 +682,7 @@ void for_each_field_dispatcher(T& t, F&& f, std::index_sequence<I...>) {
|
||||
constexpr T tmp{ ubiq_constructor_constexpr_copy{I}... };
|
||||
(void)tmp;
|
||||
|
||||
//static_assert(is_constexpr_aggregate_initializable<T, I...>::value, "T must be a constexpr initializable type");
|
||||
//static_assert(is_constexpr_aggregate_initializable<T, I...>::value, "====================> Boost.PFR: T must be a constexpr initializable type");
|
||||
|
||||
constexpr bool is_flat_refelectable_val = is_flat_refelectable<T>( std::index_sequence<I...>{} );
|
||||
for_each_field_dispatcher_1(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2017 Alexandr Poltavsky, Antony Polukhin.
|
||||
// Copyright (c) 2017-2018 Alexandr Poltavsky, Antony Polukhin.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -142,7 +142,7 @@ template <class T>
|
||||
auto tie_or_value(T& val, std::enable_if_t<std::is_union< std::remove_reference_t<T> >::value>* = 0) noexcept {
|
||||
static_assert(
|
||||
sizeof(T) && false,
|
||||
"For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ template <class T>
|
||||
auto tie_as_flat_tuple(T& t) {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to flat_ reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
auto rec_tuples = boost::pfr::detail::tie_as_tuple_recursively(
|
||||
boost::pfr::detail::tie_as_tuple_loophole_impl(t)
|
||||
@@ -194,7 +194,7 @@ template <class T>
|
||||
auto tie_as_tuple(T& val) noexcept {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
return boost::pfr::detail::tie_as_tuple_loophole_impl(
|
||||
val
|
||||
@@ -205,7 +205,7 @@ template <class T, class F, std::size_t... I>
|
||||
void for_each_field_dispatcher(T& t, F&& f, std::index_sequence<I...>) {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
std::forward<F>(f)(
|
||||
boost::pfr::detail::tie_as_tuple_loophole_impl(t)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -41,7 +41,7 @@ constexpr bool do_structured_bindings_work() noexcept { // *********************
|
||||
|
||||
static_assert(
|
||||
do_structured_bindings_work<do_not_define_std_tuple_size_for_me>(),
|
||||
"Your compiler can not handle C++17 structured bindings. Read the above comments for workarounds."
|
||||
"====================> Boost.PFR: Your compiler can not handle C++17 structured bindings. Read the above comments for workarounds."
|
||||
);
|
||||
|
||||
#endif // #ifndef _MSC_VER
|
||||
@@ -50,7 +50,7 @@ template <class T, class F, std::size_t... I>
|
||||
void for_each_field_dispatcher(T& t, F&& f, std::index_sequence<I...>) {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
std::forward<F>(f)(
|
||||
detail::tie_as_tuple(t)
|
||||
|
||||
@@ -1030,7 +1030,7 @@ template <class T>
|
||||
constexpr auto tie_as_tuple(T& val) noexcept {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
typedef size_t_<fields_count<T>()> fields_count_tag;
|
||||
return boost::pfr::detail::tie_as_tuple(val, fields_count_tag{});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -146,24 +146,24 @@ constexpr std::size_t fields_count() noexcept {
|
||||
|
||||
static_assert(
|
||||
!std::is_reference<type>::value,
|
||||
"Attempt to get fields count on a reference. This is not allowed because that could hide an issue and different library users expect different behavior in that case."
|
||||
"====================> Boost.PFR: Attempt to get fields count on a reference. This is not allowed because that could hide an issue and different library users expect different behavior in that case."
|
||||
);
|
||||
|
||||
static_assert(
|
||||
std::is_copy_constructible<std::remove_all_extents_t<type>>::value,
|
||||
"Type and each field in the type must be copy constructible."
|
||||
"====================> Boost.PFR: Type and each field in the type must be copy constructible."
|
||||
);
|
||||
|
||||
static_assert(
|
||||
!std::is_polymorphic<type>::value,
|
||||
"Type must have no virtual function, because otherwise it is not aggregate initializable."
|
||||
"====================> Boost.PFR: Type must have no virtual function, because otherwise it is not aggregate initializable."
|
||||
);
|
||||
|
||||
#ifdef __cpp_lib_is_aggregate
|
||||
static_assert(
|
||||
std::is_aggregate<type>::value // Does not return `true` for build in types.
|
||||
|| std::is_standard_layout<type>::value, // Does not return `true` for structs that have non standard layout members.
|
||||
"Type must be aggregate initializable."
|
||||
"====================> Boost.PFR: Type must be aggregate initializable."
|
||||
);
|
||||
#endif
|
||||
|
||||
@@ -180,12 +180,12 @@ constexpr std::size_t fields_count() noexcept {
|
||||
|
||||
static_assert(
|
||||
is_aggregate_initializable_n<type, result>::value,
|
||||
"Types with user specified constructors (non-aggregate initializable types) are not supported."
|
||||
"====================> Boost.PFR: Types with user specified constructors (non-aggregate initializable types) are not supported."
|
||||
);
|
||||
|
||||
static_assert(
|
||||
result != 0 || std::is_empty<type>::value || std::is_fundamental<type>::value || std::is_reference<type>::value,
|
||||
"Something went wrong. Please report this issue to the github along with the structure you're reflecting."
|
||||
"====================> Boost.PFR: Something went wrong. Please report this issue to the github along with the structure you're reflecting."
|
||||
);
|
||||
|
||||
return result;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2017 Chris Beck
|
||||
// Copyright (c) 2017-2018 Chris Beck
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -60,12 +60,12 @@ template <typename U, typename S>
|
||||
class offset_based_getter {
|
||||
using this_t = offset_based_getter<U, S>;
|
||||
|
||||
static_assert(sizeof(U) == sizeof(S), "Member sequence does not indicate correct size for struct type!");
|
||||
static_assert(alignof(U) == alignof(S), "Member sequence does not indicate correct alignment for struct type!");
|
||||
static_assert(sizeof(U) == sizeof(S), "====================> Boost.PFR: Member sequence does not indicate correct size for struct type!");
|
||||
static_assert(alignof(U) == alignof(S), "====================> Boost.PFR: Member sequence does not indicate correct alignment for struct type!");
|
||||
|
||||
static_assert(!std::is_const<U>::value, "const should be stripped from user-defined type when using offset_based_getter or overload resolution will be ambiguous later, this indicates an error within pfr");
|
||||
static_assert(!std::is_reference<U>::value, "reference should be stripped from user-defined type when using offset_based_getter or overload resolution will be ambiguous later, this indicates an error within pfr");
|
||||
static_assert(!std::is_volatile<U>::value, "volatile should be stripped from user-defined type when using offset_based_getter or overload resolution will be ambiguous later. this indicates an error within pfr");
|
||||
static_assert(!std::is_const<U>::value, "====================> Boost.PFR: const should be stripped from user-defined type when using offset_based_getter or overload resolution will be ambiguous later, this indicates an error within pfr");
|
||||
static_assert(!std::is_reference<U>::value, "====================> Boost.PFR: reference should be stripped from user-defined type when using offset_based_getter or overload resolution will be ambiguous later, this indicates an error within pfr");
|
||||
static_assert(!std::is_volatile<U>::value, "====================> Boost.PFR: volatile should be stripped from user-defined type when using offset_based_getter or overload resolution will be ambiguous later. this indicates an error within pfr");
|
||||
|
||||
// Get type of idx'th member
|
||||
template <std::size_t idx>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -87,31 +87,31 @@ struct tuple: tuple_base<
|
||||
|
||||
template <std::size_t N, class ...T>
|
||||
constexpr decltype(auto) get(tuple<T...>& t) noexcept {
|
||||
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
|
||||
static_assert(N < tuple<T...>::size_v, "====================> Boost.PFR: Tuple index out of bounds");
|
||||
return get_impl<N>(t);
|
||||
}
|
||||
|
||||
template <std::size_t N, class ...T>
|
||||
constexpr decltype(auto) get(const tuple<T...>& t) noexcept {
|
||||
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
|
||||
static_assert(N < tuple<T...>::size_v, "====================> Boost.PFR: Tuple index out of bounds");
|
||||
return get_impl<N>(t);
|
||||
}
|
||||
|
||||
template <std::size_t N, class ...T>
|
||||
constexpr decltype(auto) get(const volatile tuple<T...>& t) noexcept {
|
||||
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
|
||||
static_assert(N < tuple<T...>::size_v, "====================> Boost.PFR: Tuple index out of bounds");
|
||||
return get_impl<N>(t);
|
||||
}
|
||||
|
||||
template <std::size_t N, class ...T>
|
||||
constexpr decltype(auto) get(volatile tuple<T...>& t) noexcept {
|
||||
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
|
||||
static_assert(N < tuple<T...>::size_v, "====================> Boost.PFR: Tuple index out of bounds");
|
||||
return get_impl<N>(t);
|
||||
}
|
||||
|
||||
template <std::size_t N, class ...T>
|
||||
constexpr decltype(auto) get(tuple<T...>&& t) noexcept {
|
||||
static_assert(N < tuple<T...>::size_v, "Tuple index out of bounds");
|
||||
static_assert(N < tuple<T...>::size_v, "====================> Boost.PFR: Tuple index out of bounds");
|
||||
return get_impl<N>(std::move(t));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -68,7 +68,7 @@ struct size_array<0> { // libc++ misses constexpr on ope
|
||||
|
||||
template <std::size_t I, std::size_t N>
|
||||
constexpr std::size_t get(const size_array<N>& a) noexcept {
|
||||
static_assert(I < N, "Array index out of bounds");
|
||||
static_assert(I < N, "====================> Boost.PFR: Array index out of bounds");
|
||||
return a.data[I];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2016-2017 Antony Polukhin
|
||||
// Copyright (c) 2016-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -70,7 +70,7 @@ template <class T>
|
||||
constexpr auto tie_as_tuple(T& val) noexcept {
|
||||
static_assert(
|
||||
!std::is_union<T>::value,
|
||||
"For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. It could lead to crashes (for example when attempting to output the union with inactive first `const char*` field)."
|
||||
);
|
||||
typedef size_t_<fields_count<T>()> fields_count_tag;
|
||||
return boost::pfr::detail::tie_as_tuple(val, fields_count_tag{});
|
||||
|
||||
Reference in New Issue
Block a user