5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_DEFAULT_CONSTRUCTIBLE_PROPERTIES_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_TESTING_DEFAULT_CONSTRUCTIBLE_PROPERTIES_HPP_
11#include "arene/base/stdlib_choice/enable_if.hpp"
12#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
13#include "arene/base/stdlib_choice/is_default_constructible.hpp"
14#include "arene/base/stdlib_choice/terminate.hpp"
16#include "testlibs/utilities/constexpr_traits.hpp"
18#if ARENE_IS_OFF(ARENE_STDLIB_LIBARENECXX)
31template <class T, arene::base::constraints<std::enable_if_t<!std::is_default_constructible<T>::value>> =
nullptr>
32constexpr auto assert_default_constructed_instances_are_equal() ->
void {}
42 std::enable_if_t<std::is_default_constructible<T>::value>,
44auto assert_default_constructed_instances_are_equal() ->
void {
46#if ARENE_IS_OFF(ARENE_STDLIB_LIBARENECXX)
48 <<
" but two default constructed instances do not compare equal\n";
61 std::enable_if_t<std::is_default_constructible<T>::value>,
63constexpr auto assert_default_constructed_instances_are_equal() ->
void {
66 constexpr bool are_equal = T{} == T{};
69 "test provided a default constructible value, but two default constructed instances do not compare equal"
81constexpr auto assert_copied_value_equals_original() ->
void {}
91 std::enable_if_t<std::is_default_constructible<T>::value>,
92 std::enable_if_t<std::is_copy_constructible<T>::value>,
94auto assert_copied_value_equals_original() ->
void {
95 auto const original = T{};
96 auto const copy = original;
97 if (!(original ==
copy)) {
98#if ARENE_IS_OFF(ARENE_STDLIB_LIBARENECXX)
100 <<
" but a copy of the default constructed instance does not compare equal to the original\n";
114 std::enable_if_t<std::is_default_constructible<T>::value>,
115 std::enable_if_t<std::is_copy_constructible<T>::value>,
117constexpr auto assert_copied_value_equals_original() ->
void {
118 constexpr auto original = T{};
119 constexpr auto copy = original;
123 constexpr auto are_equal = original ==
copy;
126 "test provided a default constructible value, but a copy of the default constructed instance does not compare "
127 "equal to the original"
140 detail::assert_default_constructed_instances_are_equal<T>();
141 detail::assert_copied_value_equals_original<T>();
static constexpr value_type value
Definition integral_constant.hpp:34
Definition customization.hpp:31
constexpr auto assert_default_constructible_properties() -> void
Assert default constructible types have the expected properties.
Definition default_constructible_properties.hpp:139
Definition accumulate.hpp:37
constexpr auto copy(InputIterator first, InputIterator last, OutputIterator output) noexcept(noexcept(*(++output)) &&noexcept(*(++first)) &&noexcept(first !=last) &&std::is_nothrow_assignable<, typename std::iterator_traits< InputIterator >::reference >::value) -> OutputIterator
Copies the elements in the range, defined by [first, last), to another range beginning at output.
Definition copy.hpp:40
constexpr auto type_name_v
The name of a type as an inline_string.
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
void terminate() noexcept
function called when exception handling fails
Definition terminate.cpp:26