Skip to content
Snippets Groups Projects
Commit 6b9b2c5b authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[PL] Use Boost::Mp11 type aliases

parent 4fcc1f94
No related branches found
No related tags found
No related merge requests found
......@@ -229,14 +229,14 @@ auto applyImpl(Function&& f, Args&&... args) ->
mp_transform<std::remove_cvref_t, FlattenedTuple>;
static_assert(
boost::mp11::mp_is_set<FlattenedTupleOfPlainTypes>::value,
mp_is_set_v<FlattenedTupleOfPlainTypes>,
"The types of all elements of all passed tuples must be unique.");
using FunctionArgumentTypesPlain =
typename detail::GetFunctionArgumentTypesPlain<FunctionPlain>::type;
static_assert(
boost::mp11::mp_is_set<FunctionArgumentTypesPlain>::value,
mp_is_set_v<FunctionArgumentTypesPlain>,
"The argument types of the function to be called must be unique.");
return unpackAndInvoke(FunctionArgumentTypesPlain{},
......
......@@ -11,6 +11,8 @@
#include <boost/mp11.hpp>
#include "BaseLib/BoostMP11Utils.h"
namespace ProcessLib::Graph
{
namespace detail
......@@ -43,16 +45,6 @@ struct GetFlattenedTupleTypes
using type = boost::mp11::mp_flatten<std::tuple<Tuples...>>;
};
// Alias to be used together with static_assert to improve possible compile
// error messages.
template <typename List, typename Elem>
constexpr bool mp_contains_v = boost::mp11::mp_contains<List, Elem>::value;
// Alias to be used together with static_assert to improve possible compile
// error messages
template <typename Set>
constexpr bool mp_is_set_v = boost::mp11::mp_is_set<Set>::value;
} // namespace detail
/// Type-based access of an element of any of the passed tuples.
......@@ -77,10 +69,10 @@ auto& get(Tuples&... ts)
mp_transform<std::remove_cvref_t, FlattenedTuple>;
static_assert(
detail::mp_is_set_v<FlattenedTupleOfPlainTypes>,
mp_is_set_v<FlattenedTupleOfPlainTypes>,
"The types of all elements of all passed tuples must be unique.");
static_assert(detail::mp_contains_v<FlattenedTupleOfPlainTypes, T>,
static_assert(mp_contains_v<FlattenedTupleOfPlainTypes, T>,
"Type T must be inside any of the passed tuples.");
return detail::getImpl<T>(ts...);
......
......@@ -12,6 +12,7 @@
#include <boost/mp11.hpp>
#include "BaseLib/BoostMP11Utils.h"
#include "BaseLib/StrongType.h"
#include "MathLib/KelvinVector.h"
#include "ReflectionData.h"
......@@ -113,7 +114,7 @@ auto reflect(std::type_identity<std::tuple<Ts...>>)
// The types Ts... must be unique. Duplicate types are incompatible with the
// concept of "reflected" I/O: they would lead to duplicate names for the
// I/O data.
static_assert(mp_is_set<mp_list<Ts...>>::value);
static_assert(mp_is_set_v<mp_list<Ts...>>);
return reflectWithoutName<std::tuple<Ts...>>(
[](auto& tuple_) -> auto& { return std::get<Ts>(tuple_); }...);
......@@ -462,9 +463,10 @@ void forEachReflectedFlattenedIPDataAccessor(ReflData const& reflection_data,
// AccessorResult must be a std::vector<SomeType, SomeAllocator>. We
// check that, now.
static_assert(boost::mp11::mp_is_list<AccessorResult>::
value); // std::vector<SomeType, SomeAllocator>
// is a list in the Boost MP11 sense
static_assert(
mp_is_list_v<AccessorResult>); // std::vector<SomeType,
// SomeAllocator> is a list in
// the Boost MP11 sense
static_assert(
std::is_same_v<
AccessorResult,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment