concepts: add constructible_from

This commit is contained in:
Danny Robson 2020-02-24 14:36:40 +11:00
parent 6a15651694
commit df924f049b

View File

@ -34,9 +34,14 @@ namespace cruft::concepts {
template <typename T> template <typename T>
concept unsigned_integral = integral<T> && std::is_unsigned_v<T>; concept unsigned_integral = integral<T> && std::is_unsigned_v<T>;
template <typename T>
concept destructible = std::is_nothrow_destructible_v<T>;
template <class T, typename ...ArgsT>
concept constructible_from = destructible<T> && std::is_constructible_v<T, ArgsT...>;
template <class T> template <class T>
concept default_constructible = std::is_default_constructible_v<T>; concept default_constructible = constructible_from<T>;
template <class T> template <class T>
concept copy_constructible = std::is_copy_constructible_v<T>; concept copy_constructible = std::is_copy_constructible_v<T>;
@ -44,9 +49,6 @@ namespace cruft::concepts {
template <class T> template <class T>
concept move_constructible = std::is_move_constructible_v<T>; concept move_constructible = std::is_move_constructible_v<T>;
template <typename T>
concept destructible = std::is_nothrow_destructible_v<T>;
template <typename A, typename B> template <typename A, typename B>
concept same_as = std::is_same_v<A, B> and std::is_same_v<B, A>; concept same_as = std::is_same_v<A, B> and std::is_same_v<B, A>;