Bug Vanquisher

25 October 2008

C++: Another Love Story

Filed under: C++ — Tanveer Badar @ 1:21 AM

After many moons, the story is like this:

Given,

    int array [ 12 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 };

The sequence of function calls

    // reflexive returns true, is_prime is true for primes (hard-coded for now) and is_even returns true for even numbers.
    abc = query::as_query( abc ).where( reflexive( ) ).where( is_prime( ) ).where( is_even( ) ).to_array( );

    for( int i = 0 ; i < abc.size( ) ; ++i )
        std::cout << abc [ i ] << ‘ ‘;

prints 2. Btw, there was a serious bug in the implementation of where( ) which is fixed now.

Additionally,
>    Query.exe!query::queryable<
                            query::filter_iterator<
                                query::filter_iterator<
                                    std::_Vector_iterator<int,std::allocator<int> >,
                                                        reflexive>,
                            is_prime> >::
                    where<is_even>(const is_even & fn={…})  Line 240    C++

This should prove delayed execution I believe. Now, all I have to do is wait for lambda expressions in C++, coming sometime next year.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: