Skip to content

Commit

Permalink
Merge pull request #1211 from ericniebler/adaptor-conversions
Browse files Browse the repository at this point in the history
Switch adaptor converting constructors from CPP_template to CPP_ctor
  • Loading branch information
ericniebler authored Jun 2, 2019
2 parents 0444764 + 033c41f commit 66c9f5f
Show file tree
Hide file tree
Showing 19 changed files with 73 additions and 72 deletions.
6 changes: 3 additions & 3 deletions include/range/v3/view/adjacent_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ namespace ranges
constexpr adaptor(Parent & rng) noexcept
: rng_(&rng)
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
constexpr adaptor(adaptor<Other> that)
template<bool Other>
constexpr CPP_ctor(adaptor)(adaptor<Other> that)( //
requires Const && (!Other))
: rng_(that.rng_)
{}
constexpr void next(iterator_t<CRng> & it) const
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/cartesian_product.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ namespace ranges
: cursor(end_tag{}, view,
meta::bool_<CommonView<meta::at_c<meta::list<Views...>, 0>>>{})
{}
CPP_template(bool Other)( //
requires IsConst_ && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires IsConst_ && (!Other))
: view_(that.view_)
, its_(std::move(that.its_))
{}
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ namespace ranges
, n_((RANGES_EXPECT(0 < cv.n_), cv.n_))
, end_(ranges::end(cv.base()))
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
constexpr adaptor(adaptor<Other> that)
template<bool Other>
constexpr CPP_ctor(adaptor)(adaptor<Other> that)( //
requires Const && (!Other))
: box<offset_t<Const>>(that.offset())
, n_(that.n_)
, end_(that.end_)
Expand Down
12 changes: 6 additions & 6 deletions include/range/v3/view/concat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ namespace ranges
sentinel(concat_view_t & rng, end_tag)
: end_(end(std::get<cranges - 1>(rng.rngs_)))
{}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
sentinel(sentinel<Other> that)
template<bool Other>
CPP_ctor(sentinel)(sentinel<Other> that)( //
requires IsConst && (!Other))
: end_(std::move(that.end_))
{}
};
Expand Down Expand Up @@ -264,9 +264,9 @@ namespace ranges
: rng_(&rng)
, its_{emplaced_index<cranges - 1>, end(std::get<cranges - 1>(rng.rngs_))}
{}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires IsConst && (!Other))
: rng_(that.rng_)
, its_(std::move(that.its_))
{}
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/const.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ namespace ranges
using rvalue_reference_ =
common_reference_t<value_ const &&, range_rvalue_reference_t<CRng>>;
adaptor() = default;
CPP_template(bool Other)( //
requires Const && (!Other)) //
constexpr adaptor(adaptor<Other>)
template<bool Other>
constexpr CPP_ctor(adaptor)(adaptor<Other>)( //
requires Const && (!Other))
{}
reference_ read(iterator_t<CRng> const & it) const
{
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/cycle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ namespace ranges
: rng_(&rng)
, it_(ranges::begin(rng.rng_))
{}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires IsConst && (!Other))
: rng_(that.rng_)
, it_(std::move(that.it_))
{}
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/exclusive_scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ namespace ranges
adaptor(exclusive_scan_view_t & rng)
: rng_(&rng)
{}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
adaptor(adaptor<Other> that)
template<bool Other>
CPP_ctor(adaptor)(adaptor<Other> that)( //
requires IsConst && (!Other))
: rng_(that.rng_)
{}
iterator_t<CRng> begin(exclusive_scan_view_t &)
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/group_by.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ namespace ranges

public:
cursor() = default;
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires IsConst && (!Other))
: cur_(std::move(that.cur_))
, last_(std::move(last_))
, fun_(std::move(that.fun_))
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/indirect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ namespace ranges
using CRng = meta::const_if_c<IsConst, Rng>;

adaptor() = default;
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
constexpr adaptor(adaptor<Other>) noexcept
template<bool Other> // clang-format off
constexpr CPP_ctor(adaptor)(adaptor<Other>)( noexcept(true)
requires IsConst && (!Other)) // clang-format on
{}

// clang-format off
Expand Down
12 changes: 6 additions & 6 deletions include/range/v3/view/intersperse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ namespace ranges
explicit constexpr cursor_adaptor(range_value_t<Rng> const & val)
: val_{val}
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
cursor_adaptor(cursor_adaptor<Other> that)
template<bool Other>
CPP_ctor(cursor_adaptor)(cursor_adaptor<Other> that)( //
requires Const && (!Other))
: toggle_(that.toggle_)
, val_(std::move(that.val_))
{}
Expand Down Expand Up @@ -141,9 +141,9 @@ namespace ranges

public:
sentinel_adaptor() = default;
CPP_template(bool Other)( //
requires Const && (!Other)) //
sentinel_adaptor(sentinel_adaptor<Other>)
template<bool Other>
CPP_ctor(sentinel_adaptor)(sentinel_adaptor<Other>)( //
requires Const && (!Other))
{}
static constexpr bool empty(iterator_t<CRng> const & it,
cursor_adaptor<Const> const &,
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/move.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ namespace ranges
struct adaptor : adaptor_base
{
adaptor() = default;
CPP_template(bool Other)( //
requires Const && (!Other)) //
constexpr adaptor(adaptor<Other>)
template<bool Other>
constexpr CPP_ctor(adaptor)(adaptor<Other>)( //
requires Const && (!Other))
{}
using CRng = meta::const_if_c<Const, Rng>;
using value_type = range_value_t<Rng>;
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/sample.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ namespace ranges
rng.size_ = n;
advance();
}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires IsConst && (!Other))
: parent_(that.parent_)
, current_(std::move(that.current_))
, size_(that.size_)
Expand Down
7 changes: 4 additions & 3 deletions include/range/v3/view/set_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,10 @@ namespace ranges
{
satisfy();
}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
set_union_cursor(set_union_cursor<Other, Rng1, Rng2, C, P1, P2> that)
template<bool Other>
CPP_ctor(set_union_cursor)(
set_union_cursor<Other, Rng1, Rng2, C, P1, P2> that)( //
requires IsConst && (!Other))
: pred_(std::move(that.pred_))
, proj1_(std::move(that.proj1_))
, proj2_(std::move(that.proj2_))
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/sliding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ namespace ranges
adaptor(range_difference_t<Rng> n)
: n_(n)
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
adaptor(adaptor<Other> that)
template<bool Other>
CPP_ctor(adaptor)(adaptor<Other> that)( //
requires Const && (!Other))
: n_(that.n_)
{}
iterator_t<CRng> end(meta::const_if_c<Const, sliding_view> & v) const
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/split_when.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ namespace ranges

public:
cursor() = default;
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires IsConst && (!Other))
: cursor{std::move(that.cur_), std::move(that.last_), std::move(that.fun_)}
{}
};
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/stride.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ namespace ranges
constexpr adaptor(stride_view_t & rng) noexcept
: rng_(&rng)
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
adaptor(adaptor<Other> that)
template<bool Other>
CPP_ctor(adaptor)(adaptor<Other> that)( //
requires Const && (!Other))
: rng_(that.rng_)
{}
constexpr void next(iterator_t<CRng> & it)
Expand Down
6 changes: 3 additions & 3 deletions include/range/v3/view/take_while.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ namespace ranges
sentinel_adaptor(semiregular_ref_or_val_t<Pred, IsConst> pred)
: pred_(std::move(pred))
{}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
sentinel_adaptor(sentinel_adaptor<Other> that)
template<bool Other>
CPP_ctor(sentinel_adaptor)(sentinel_adaptor<Other> that)( //
requires IsConst && (!Other))
: pred_(std::move(that.pred_))
{}
bool empty(iterator_t<CRng> const & it, sentinel_t<CRng> const & end) const
Expand Down
18 changes: 9 additions & 9 deletions include/range/v3/view/transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ namespace ranges
adaptor(fun_ref_ fun)
: fun_(std::move(fun))
{}
CPP_template(bool Other)( //
requires IsConst && (!Other)) //
adaptor(adaptor<Other> that)
template<bool Other>
CPP_ctor(adaptor)(adaptor<Other> that)( //
requires IsConst && (!Other))
: fun_(std::move(that.fun_))
{}

Expand Down Expand Up @@ -231,9 +231,9 @@ namespace ranges
: end1_(end(parent.rng1_))
, end2_(end(parent.rng2_))
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
sentinel(sentinel<Other> that)
template<bool Other>
CPP_ctor(sentinel)(sentinel<Other> that)( //
requires Const && (!Other))
: end1_(std::move(that.end1_))
, end2_(std::move(that.end2_))
{}
Expand Down Expand Up @@ -266,9 +266,9 @@ namespace ranges
, it1_(begin_end(parent.rng1_))
, it2_(begin_end(parent.rng2_))
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires Const && (!Other))
: fun_(std::move(that.fun_))
, it1_(std::move(that.end1_))
, it2_(std::move(that.end2_))
Expand Down
12 changes: 6 additions & 6 deletions include/range/v3/view/zip_with.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ namespace ranges
std::tuple<sentinel_t<meta::const_if_c<Const, Rngs>>...> ends)
: ends_(std::move(ends))
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
sentinel(sentinel<Other> that)
template<bool Other>
CPP_ctor(sentinel)(sentinel<Other> that)( //
requires Const && (!Other))
: ends_(std::move(that.ends_))
{}
};
Expand Down Expand Up @@ -210,9 +210,9 @@ namespace ranges
: fun_(std::move(fun))
, its_(std::move(its))
{}
CPP_template(bool Other)( //
requires Const && (!Other)) //
cursor(cursor<Other> that)
template<bool Other>
CPP_ctor(cursor)(cursor<Other> that)( //
requires Const && (!Other))
: fun_(std::move(that.fun_))
, its_(std::move(that.its_))
{}
Expand Down

0 comments on commit 66c9f5f

Please sign in to comment.