Skip to content

Commit

Permalink
update from main repo
Browse files Browse the repository at this point in the history
  • Loading branch information
treh committed Aug 19, 2016
1 parent 8f0091d commit c04af20
Show file tree
Hide file tree
Showing 73 changed files with 3,684 additions and 2,195 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ If the boost library is not in the default location, you can specify the path wi

cmake -DBOOST_ROOT=/path/to/boost_1_59_0 ./range/

You need to apply boost_patches/has_range_iterator.patch to your boost library.
This is equivalent to https://github.com/boostorg/range/pull/40 (accepted, but not merged into release yet)

The Range specific code is under https://github.com/think-cell/range/tree/master/range

The tests and examples are in range/*.t.cpp

Tested with:
* clang 3.5
* clang 3.8 (due to a libc++ bug you need to also include the libc++abi-dev headers)
* msvc 2015

Usage on Windows:
Expand Down
23 changes: 23 additions & 0 deletions boost_patches/has_range_iterator.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- ./boost/range/has_range_iterator.hpp
+++ ./boost/range/has_range_iterator.hpp
@@ -37,9 +37,9 @@ namespace boost
T,
BOOST_DEDUCED_TYPENAME ::boost::enable_if<
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_const<T>,
- has_type<range_const_iterator<
+ has_type<boost::range_const_iterator<
BOOST_DEDUCED_TYPENAME remove_const<T>::type> >,
- has_type<range_mutable_iterator<T> >
+ has_type<boost::range_mutable_iterator<T> >
>::type
>::type
>
@@ -57,7 +57,7 @@ namespace boost
struct has_range_const_iterator_impl<
T,
BOOST_DEDUCED_TYPENAME ::boost::enable_if<
- has_type<range_const_iterator<T> >
+ has_type<boost::range_const_iterator<T> >
>::type
>
: boost::mpl::true_
2 changes: 0 additions & 2 deletions range/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ set(TC_Utils
counting_range.h
empty_chain.h
implements_compare.h
in_place.h
is_static_castable.h
make_lazy.h
modified.h
noncopyable.h
reference_or_value.h
remove_cvref.h
renew.h
return_decltype.h
trivial_functors.h
Expand Down
24 changes: 12 additions & 12 deletions range/accumulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,31 @@ struct fundamental_base<void> {};

template<typename Base>
struct fundamental_base<Base,std::enable_if_t<!std::is_class< Base >::value >> {
operator Base const&() const noexcept {
operator Base const&() const& noexcept {
return _get();
}

operator Base &() noexcept {
operator Base &() & noexcept {
return _get();
}

private:
Base m_base;

protected:
public:
fundamental_base() noexcept {}

protected:
template< typename A1 >
fundamental_base(A1&& a1) noexcept
: m_base(std::forward<A1>(a1))
{}

Base const& _get() const noexcept {
Base const& _get() const& noexcept {
return m_base;
}

Base & _get() noexcept {
Base & _get() & noexcept {
return m_base;
}
};
Expand All @@ -73,11 +74,11 @@ struct fundamental_base<Base,std::enable_if_t< std::is_class< Base >::value >>
: public Base
{
protected:
Base const& _get() const noexcept {
Base const& _get() const& noexcept {
return tc::base_cast<Base>(*this);
}

Base & _get() noexcept {
Base & _get() & noexcept {
return tc::base_cast<Base>(*this);
}

Expand All @@ -87,22 +88,21 @@ struct fundamental_base<Base,std::enable_if_t< std::is_class< Base >::value >>
};

template<typename Value, typename Accumulate>
struct FAccumulator final : fundamental_base< std::decay_t<Value> > {
using fundamental_base = fundamental_base< std::decay_t<Value> >;
using result_type = void;
struct FAccumulator final : fundamental_base< tc::decay_t<Value> > {
using fundamental_base = fundamental_base< tc::decay_t<Value> >;

FAccumulator(Value&& value, Accumulate&& accumulate) noexcept
: fundamental_base( std::forward<Value>(value) )
, m_accumulate(std::forward<Accumulate>(accumulate))
{}

template<typename... Args>
void operator() (Args&& ... args) noexcept {
void operator() (Args&& ... args) & noexcept {
m_accumulate(this->_get(), std::forward<Args>(args)...);
}

private:
std::decay_t<Accumulate> m_accumulate;
tc::decay_t<Accumulate> m_accumulate;
};

///////////////////////////////////////////////
Expand Down
Loading

0 comments on commit c04af20

Please sign in to comment.