Skip to content

Commit

Permalink
Merge pull request #94 from CaseyCarter/move-only-readable
Browse files Browse the repository at this point in the history
iterators that return move-only types by value should satisfy Readable
  • Loading branch information
CaseyCarter authored Apr 4, 2017
2 parents 1aa042d + 9419a6c commit 82bdd8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/stl2/detail/iterator/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ STL2_OPEN_NAMESPACE {
typename rvalue_reference_t<I>;
} &&
// Relationships between associated types
CommonReference<reference_t<I>, value_type_t<I>&>() &&
CommonReference<reference_t<I>, rvalue_reference_t<I>>() &&
CommonReference<rvalue_reference_t<I>, const value_type_t<I>&>();
CommonReference<reference_t<I>&&, value_type_t<I>&>() &&
CommonReference<reference_t<I>&&, rvalue_reference_t<I>&&>() &&
CommonReference<rvalue_reference_t<I>&&, const value_type_t<I>&>();
}

namespace models {
Expand Down
8 changes: 8 additions & 0 deletions test/concepts/iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ namespace readable_test {
CONCEPT_ASSERT(models::Readable<const int*>);
CONCEPT_ASSERT(models::Readable<A>);
CONCEPT_ASSERT(models::Same<ns::value_type_t<A>,int>);

struct MoveOnlyReadable
{
using value_type = std::unique_ptr<int>;
value_type operator*() const;
};

CONCEPT_ASSERT(models::Readable<MoveOnlyReadable>);
}

namespace writable_test {
Expand Down

0 comments on commit 82bdd8d

Please sign in to comment.