Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

string_set_lexeme.cpp


SourceForge.net Logo     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;
}
This program displays the following output:
data: /one two three/



Copyright © 1997-2006 Igor Kholodov mailto:cttl@users.sourceforge.net.

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.


Generated on Thu Nov 2 17:44:56 2006 for Common Text Transformation Library by  doxygen 1.3.9.1