cpplinq-20121008

Rating: No reviews yet
Downloads: 10
Change Set: 0b3ac67c73f1
Released: Oct 8, 2012
Updated: Oct 8, 2012 by MariusBancila
Dev status: Beta Help Icon

Recommended Download

Source Code cpplinq.hpp
source code, 119K, uploaded Oct 8, 2012 - 10 downloads

Release Notes

LINQ for C++ (cpplinq) is an extensible C++11 library of higher-order functions for range manipulation. cpplinq draws inspiration from LINQ for C#.

This release includes just the source code.

What's new in this release:
  • aggregate operators: count, min, max, avg, aggregate
  • quantifiers: any, all, contains
  • generation operators: repeat, empty
  • element operators: first renamed as first_or_default, last_or_default, element_at_or_default
  • conversion operators: to_list
  • partitioning operators: take, skip, take_while, skip_while

This is a sample on how to use cpplinq:
#include "cpplinq.hpp"

int computes_a_sum ()
{
    using namespace cpplinq;    
    int ints[] = {3,1,4,1,5,9,2,6,5,4};

    // Computes the sum of all even numbers in the sequence above
    return 
            from_array (ints)
        >>  where ([](int i) {return i%2 ==0;})     // Keep only even numbers
        >>  sum ()                                  // Sum remaining numbers
        ;
}

See documentation for more details.

Reviews for this release

No reviews yet for this release.