CTTL on
SourceForge |
Download
Latest |
Documentation
Index |
Library
News |
CVS
Repository |
Other
Links |
Demonstrates begin(std::set<std::string>&)
, the string set lexeme.
// sample code: string_set_lexeme.cpp // demonstrates begin( std::set< std::string > ) lexeme #include <iostream> #include "cttl/cttl.h" using namespace cttl; int main() { std::set< std::string > numbers; numbers.insert( "one" ); numbers.insert( "two" ); numbers.insert( "three" ); numbers.insert( "fourteen" ); input<> inp( "one two three four fourteen" ); const_edge< policy_space<> > universe( new_edge( inp ) ); const_edge<> data( new_edge( inp ) ); if ( data( +( entity( isalpha ) & begin( numbers ) ) ).match( universe ) != std::string::npos ) { std::cout << "data: /" << data.text() << '/' << std::endl; } else { std::cout << "*** evaluation failed ***" << std::endl; return 1; } /* program output: data: /one two three/ */ return 0; }
data: /one two three/
Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.