cpplinq-20130810

Rating:        Based on 2 ratings
Reviewed:  2 reviews
Downloads: 550
Change Set: e47a74017e0e
Released: Aug 10, 2013
Updated: Mar 27, 2014 by marten_range
Dev status: Stable Help Icon

Recommended Download

Application cpplinq.hpp
application, 192K, uploaded Aug 10, 2013 - 550 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:
  • Non standard #pragma once replaced with header guards
  • first() added
  • throw() removed from range::operator>> (in order to enable operators such a first() to throw on empty sequences)
  • const correctness fixes
  • code style fixes
  • Returns reference to locally scoped instance fixed

Thanks to:
  • breyed - for the implementation of first() and discussions regarding the return value semantics of cpplinq.
  • stl - for sorting out a bug in cpplinq regarding exceptions.
  • mwpowellhtx - for pointing out that #pragma once is non standard

Tested on:
  • VS2012
  • VS2013 (preview)
  • g++ 4.7.2 (with -std=c++0x)

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

     
Excellent, really like the use of operators!
by AmigaRulez on Sep 3, 2013 at 11:09 AM
     
Superb and clean implementation
by devlead on Sep 3, 2013 at 11:04 AM