Support C arrays and ADL ranges in from_range generator

Closes #2737
This commit is contained in:
Martin Hořeňovský
2023-08-29 15:37:46 +02:00
parent 85eb4652b4
commit f24d39e42b
2 changed files with 34 additions and 4 deletions

View File

@@ -96,10 +96,11 @@ GeneratorWrapper<ResultType> from_range(InputIterator from, InputSentinel to) {
return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(from, to));
}
template <typename Container,
typename ResultType = typename Container::value_type>
GeneratorWrapper<ResultType> from_range(Container const& cnt) {
return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(cnt.begin(), cnt.end()));
template <typename Container>
auto from_range(Container const& cnt) {
using std::begin;
using std::end;
return from_range( begin( cnt ), end( cnt ) );
}