mirror of
https://github.com/boostorg/regex.git
synced 2025-07-29 20:17:24 +02:00
Make sub_match a valid range as per https://svn.boost.org/trac/boost/ticket/11036
This commit is contained in:
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