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

stream output iterators


SourceForge.net Logo     CTTL on    
    SourceForge    
    Download    
    Latest    
    Documentation    
    Index    
    Library    
    News    
    CVS    
    Repository    
   Other    
   Links    

stream output iterator

#define CTTL_TRACE_RULES // automatically turns lambda tracing on

#include <iostream>
#include <iterator> 
#include "cttl/cttl.h"
#include "lambda/lambda.h"

using namespace cttl;

int main(int argc, char* argv[])
{
    lambda< std::ostream_iterator< int > >::scalar
        output( std::ostream_iterator< int >( std::cout, "<-output" ) );
    ( *output++ = scalar( 8 ) ).evaluate();
    ( *output = scalar( 9 ) ).evaluate();
    ( ++output ).evaluate();
    ( *output = scalar( 10 ), output++ ).evaluate();

    return 0;
}

operator xor

#define CTTL_TRACE_RULES // automatically turns lambda tracing on

#include <iostream>
#include <iterator>
#include "cttl/cttl.h"
#include "lambda/lambda.h"

using namespace cttl;

int main(int argc, char* argv[])
{
    lambda< std::ostream_iterator< int > >::scalar
        output( std::ostream_iterator< int >( std::cout, "<-result " ) );
    (
        *output++ = operator_xor( scalar( 0 ), scalar( 0 ) ),
        *output++ = operator_xor( scalar( 0 ), scalar( 1 ) ),
        *output++ = operator_xor( scalar( 1 ), scalar( 0 ) ),
        *output++ = operator_xor( scalar( 1 ), scalar( 1 ) )
    ).evaluate();

    return 0;
}

/*
Output:

( = ( ^  0  0 )(*-> ? )0<-result ( -> ? )++),
( = ( ^  0  1 )(*-> ? )1<-result ( -> ? )++),
( = ( ^  1  0 )(*-> ? )1<-result ( -> ? )++),
( = ( ^  1  1 )(*-> ? )0<-result ( -> ? )++)

*/



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:48:54 2006 for CTTL Lambda Expression by  doxygen 1.3.9.1