mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-29 20:17:17 +02:00
Merge pull request #112 from glywk/develop
Add is_blank() string functor classification
This commit is contained in:
@ -85,6 +85,22 @@ namespace boost {
|
|||||||
return detail::is_classifiedF(std::ctype_base::alpha, Loc);
|
return detail::is_classifiedF(std::ctype_base::alpha, Loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_CXX11
|
||||||
|
//! is_blank predicate
|
||||||
|
/*!
|
||||||
|
Construct the \c is_classified predicate for the \c ctype_base::blank category.
|
||||||
|
|
||||||
|
\param Loc A locale used for classification
|
||||||
|
\return An instance of the \c is_classified predicate
|
||||||
|
\since c++11
|
||||||
|
*/
|
||||||
|
inline detail::is_classifiedF
|
||||||
|
is_blank(const std::locale& Loc=std::locale())
|
||||||
|
{
|
||||||
|
return detail::is_classifiedF(std::ctype_base::blank, Loc);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//! is_cntrl predicate
|
//! is_cntrl predicate
|
||||||
/*!
|
/*!
|
||||||
Construct the \c is_classified predicate for the \c ctype_base::cntrl category.
|
Construct the \c is_classified predicate for the \c ctype_base::cntrl category.
|
||||||
@ -294,6 +310,9 @@ namespace boost {
|
|||||||
// pull names to the boost namespace
|
// pull names to the boost namespace
|
||||||
using algorithm::is_classified;
|
using algorithm::is_classified;
|
||||||
using algorithm::is_space;
|
using algorithm::is_space;
|
||||||
|
#ifndef BOOST_NO_CXX11
|
||||||
|
using algorithm::is_blank;
|
||||||
|
#endif
|
||||||
using algorithm::is_alnum;
|
using algorithm::is_alnum;
|
||||||
using algorithm::is_alpha;
|
using algorithm::is_alpha;
|
||||||
using algorithm::is_cntrl;
|
using algorithm::is_cntrl;
|
||||||
|
@ -667,6 +667,13 @@
|
|||||||
<functionname>is_space()</functionname>
|
<functionname>is_space()</functionname>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>is_blank</entry>
|
||||||
|
<entry>Recognize blanks</entry>
|
||||||
|
<entry>
|
||||||
|
<functionname>is_blank()</functionname>
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>is_alnum</entry>
|
<entry>is_alnum</entry>
|
||||||
<entry>Recognize alphanumeric characters</entry>
|
<entry>Recognize alphanumeric characters</entry>
|
||||||
|
@ -138,7 +138,12 @@ void classification_test()
|
|||||||
TEST_CLASS( is_any_of( string("abc") ), "aaabbcc", "aaxb" );
|
TEST_CLASS( is_any_of( string("abc") ), "aaabbcc", "aaxb" );
|
||||||
TEST_CLASS( is_any_of( "abc" ), "aaabbcc", "aaxb" );
|
TEST_CLASS( is_any_of( "abc" ), "aaabbcc", "aaxb" );
|
||||||
TEST_CLASS( is_from_range( 'a', 'c' ), "aaabbcc", "aaxb" );
|
TEST_CLASS( is_from_range( 'a', 'c' ), "aaabbcc", "aaxb" );
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_CXX11
|
||||||
|
TEST_CLASS( is_blank(), " \t", "\t \n\r" );
|
||||||
|
TEST_CLASS( !is_blank(), "abc\n\v\f\r", "a x\t" );
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_CLASS( !is_classified(std::ctype_base::space), "...", "..\n\r\t " );
|
TEST_CLASS( !is_classified(std::ctype_base::space), "...", "..\n\r\t " );
|
||||||
TEST_CLASS( ( !is_any_of("abc") && is_from_range('a','e') ) || is_space(), "d e", "abcde" );
|
TEST_CLASS( ( !is_any_of("abc") && is_from_range('a','e') ) || is_space(), "d e", "abcde" );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user