mirror of
https://github.com/boostorg/regex.git
synced 2025-07-23 17:17:22 +02:00
Make sub_match a valid range as per https://svn.boost.org/trac/boost/ticket/11036
This commit is contained in:
@ -162,6 +162,11 @@ public:
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
//
|
||||
// Make this type a range, for both Boost.Range, and C++11:
|
||||
//
|
||||
BidiIterator begin()const;
|
||||
BidiIterator end()const;
|
||||
|
||||
|
||||
#ifdef BOOST_OLD_REGEX_H
|
||||
|
@ -149,10 +149,9 @@ test-suite regex
|
||||
: : : <test-info>always_show_run_output : test_collate_info ]
|
||||
|
||||
|
||||
[ compile concepts/concept_check.cpp ../build//boost_regex
|
||||
]
|
||||
[ compile concepts/icu_concept_check.cpp ../build//boost_regex
|
||||
]
|
||||
[ compile concepts/concept_check.cpp ]
|
||||
[ compile concepts/icu_concept_check.cpp ]
|
||||
[ compile concepts/range_concept_check.cpp ]
|
||||
|
||||
[ run
|
||||
# sources
|
||||
|
41
test/concepts/range_concept_check.cpp
Normal file
41
test/concepts/range_concept_check.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
template <class T>
|
||||
void use_val(const T&){}
|
||||
|
||||
template <class T>
|
||||
void check()
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((boost::ForwardRangeConcept<T>));
|
||||
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<typename boost::range_iterator<T>::type>));
|
||||
BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversalConcept<typename boost::range_iterator<T>::type>));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RANGE_BASED_FOR
|
||||
const T val;
|
||||
for(auto item : val)
|
||||
{
|
||||
use_val(item);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
check<boost::smatch>();
|
||||
check<boost::cmatch>();
|
||||
|
||||
check <boost::sub_match<const char*> >();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user