Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renames default_constructible #1526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/concepts/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ namespace concepts
META_IS_CONSTRUCTIBLE(T, Args...);

template<typename T>
CPP_concept_bool default_constructible =
CPP_concept_bool default_initializable =
constructible_from<T>;

template<typename T>
Expand Down Expand Up @@ -1183,7 +1183,7 @@ namespace concepts
template<typename T>
CPP_concept_bool semiregular =
copyable<T> &&
default_constructible<T>;
default_initializable<T>;
// Axiom: copies are independent. See Fundamentals of Generic Programming
// http://www.stepanovpapers.com/DeSt98.pdf

Expand Down Expand Up @@ -1281,8 +1281,8 @@ namespace concepts
CPP_defer_(defs::constructible_from, CPP_type(T), Args...);

template<typename T>
CPP_concept default_constructible =
CPP_defer(defs::default_constructible, T);
CPP_concept default_initializable =
CPP_defer(defs::default_initializable, T);

template<typename T>
CPP_concept move_constructible =
Expand Down
2 changes: 1 addition & 1 deletion include/range/v3/action/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace ranges
// clang-format off
template<typename T>
CPP_concept_bool semi_container =
forward_range<T> && default_constructible<uncvref_t<T>> &&
forward_range<T> && default_initializable<uncvref_t<T>> &&
movable<uncvref_t<T>> &&
!view_<T>;

Expand Down
4 changes: 2 additions & 2 deletions include/range/v3/detail/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace ranges
CPP_member
constexpr CPP_ctor(indexed_datum)()( //
noexcept(std::is_nothrow_default_constructible<T>::value) //
requires default_constructible<T>)
requires default_initializable<T>)
: datum_{}
{}
CPP_template(typename... Ts)( //
Expand Down Expand Up @@ -681,7 +681,7 @@ namespace ranges
CPP_member
constexpr CPP_ctor(variant)()( //
noexcept(std::is_nothrow_default_constructible<datum_t<0>>::value) //
requires default_constructible<datum_t<0>>)
requires default_initializable<datum_t<0>>)
: variant{emplaced_index<0>}
{}
CPP_template(std::size_t N, typename... Args)( //
Expand Down
2 changes: 1 addition & 1 deletion include/range/v3/functional/not_fn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace ranges
CPP_member
constexpr CPP_ctor(logical_negate)()( //
noexcept(std::is_nothrow_default_constructible<FD>::value) //
requires default_constructible<FD>)
requires default_initializable<FD>)
{}
template<typename T>
explicit constexpr CPP_ctor(logical_negate)(T && pred)( //
Expand Down
2 changes: 1 addition & 1 deletion include/range/v3/iterator/basic_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace ranges
CPP_member
constexpr CPP_ctor(basic_mixin)()( //
noexcept(std::is_nothrow_default_constructible<T>::value) //
requires default_constructible<T>)
requires default_initializable<T>)
: box<T>{}
{}
CPP_member
Expand Down
4 changes: 2 additions & 2 deletions include/range/v3/utility/common_tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace ranges
CPP_ctor(common_tuple)()( //
noexcept(meta::and_c<
std::is_nothrow_default_constructible<Ts>::value...>::value) //
requires default_constructible<std::tuple<Ts...>>)
requires default_initializable<std::tuple<Ts...>>)
: common_tuple::forward_tuple_interface{}
{}
CPP_template(typename... Us)( //
Expand Down Expand Up @@ -328,7 +328,7 @@ namespace ranges
CPP_ctor(common_pair)()( //
noexcept(std::is_nothrow_default_constructible<F>::value &&
std::is_nothrow_default_constructible<S>::value) //
requires default_constructible<F> && default_constructible<S>)
requires default_initializable<F> && default_initializable<S>)
: std::pair<F, S>{}
{}
template<typename F2, typename S2>
Expand Down
8 changes: 4 additions & 4 deletions include/range/v3/utility/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace ranges
public:
CPP_member
constexpr CPP_ctor(indexed_datum)(meta::nil_ = {})(
requires default_constructible<T>)
requires default_initializable<T>)
: data_{}
{}
CPP_member
Expand All @@ -67,17 +67,17 @@ namespace ranges
std::uninitialized_copy_n(that.data_, N, data_);
}
// \pre Requires distance(first, last) <= N
// \pre Requires default_constructible<T> || distance(first, last) == N
// \pre Requires default_initializable<T> || distance(first, last) == N
template<typename I, typename S>
CPP_ctor(indexed_datum)(I first, S last)( //
requires sentinel_for<S, I> && input_iterator<I> &&
constructible_from<T, iter_reference_t<I>>)
{
T * p = detail::uninitialized_copy(first, last, data_);
this->fill_default_(p, meta::bool_<default_constructible<T>>{});
this->fill_default_(p, meta::bool_<default_initializable<T>>{});
}
// \pre Requires distance(r) <= N
// \pre Requires default_constructible<T> || distance(r) == N
// \pre Requires default_initializable<T> || distance(r) == N
template<typename R>
explicit CPP_ctor(indexed_datum)(R && r)( //
requires input_range<R> && constructible_from<T, range_reference_t<R>>)
Expand Down
2 changes: 1 addition & 1 deletion include/range/v3/view/istream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace ranges
/// \endcond
template<typename Val>
inline auto istream(std::istream & sin) -> CPP_ret(istream_view<Val>)( //
requires copy_constructible<Val> && default_constructible<Val>)
requires copy_constructible<Val> && default_initializable<Val>)
{
return istream_view<Val>{sin};
}
Expand Down
2 changes: 1 addition & 1 deletion test/algorithm/sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ namespace
return a.i_ >= b.i_;
}
};
CPP_assert(ranges::default_constructible<Int>);
CPP_assert(ranges::default_initializable<Int>);
CPP_assert(ranges::movable<Int>);
CPP_assert(ranges::totally_ordered<Int>);
}
Expand Down
16 changes: 8 additions & 8 deletions test/utility/concepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ static_assert(!ranges::movable<XXX>, "");
static_assert(!ranges::semiregular<XXX>, "");
static_assert(!ranges::regular<XXX>, "");

static_assert(ranges::default_constructible<int>, "");
static_assert(ranges::default_constructible<int const>, "");
static_assert(!ranges::default_constructible<int const &>, "");
static_assert(!ranges::default_constructible<int ()>, "");
static_assert(!ranges::default_constructible<int(&)()>, "");
static_assert(!ranges::default_constructible<int[]>, "");
static_assert(ranges::default_constructible<int[5]>, "");
static_assert(!ranges::default_constructible<nondefaultconstructible>, "");
static_assert(ranges::default_initializable<int>, "");
static_assert(ranges::default_initializable<int const>, "");
static_assert(!ranges::default_initializable<int const &>, "");
static_assert(!ranges::default_initializable<int ()>, "");
static_assert(!ranges::default_initializable<int(&)()>, "");
static_assert(!ranges::default_initializable<int[]>, "");
static_assert(ranges::default_initializable<int[5]>, "");
static_assert(!ranges::default_initializable<nondefaultconstructible>, "");

static_assert(ranges::move_constructible<int>, "");
static_assert(ranges::move_constructible<const int>, "");
Expand Down
4 changes: 2 additions & 2 deletions test/utility/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void bug_1217()
ranges::accumulate( positions_visited, 0 );
}
}

int main()
{
using namespace ranges;
Expand Down Expand Up @@ -95,7 +95,7 @@ int main()
int i = 42;
std::string s = "hello world";
variant<int&, std::string&> v{emplaced_index<0>, i};
CPP_assert(!default_constructible<variant<int&, std::string&>>);
CPP_assert(!default_initializable<variant<int&, std::string&>>);
CHECK(v.index() == 0u);
CHECK(get<0>(v) == 42);
CHECK(&get<0>(v) == &i);
Expand Down