cpplinq-20140323

Rating:        Based on 2 ratings
Reviewed:  1 review
Downloads: 2065
Change Set: 706ff1338f80f23
Released: Mar 23, 2014
Updated: Mar 23, 2014 by marten_range
Dev status: Stable Help Icon

Recommended Download

Source Code cpplinq.hpp
source code, 196K, uploaded Mar 23, 2014 - 2065 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:
  • Minor tweaks (whitespaces, closure captures and so on)
  • Preparing for noexcept (CPPLINQ_NOEXCEPT macro)
  • Added opt::clear
  • Reworked how from range sources iterates in order to reduce overhead
  • Added ref () which takes range of references and wraps it in std::reference_wrapper. Useful when storing references in a STL collection.

Thanks to:
  • nitrogene38 - For requesting ref ()

Tested on:
  • VS2013
  • g++ 4.7.1 (with -std=c++0x)
  • g++ 4.8.1 (with -std=c++11)
  • clang3.2 (with -std=c++11)

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

     
I gave a 5 stars to this release because it enables returning references in a stl vector via ref() operator.
by nitrogene38 on Mar 23, 2014 at 7:00 PM