This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Home
Linq++
Introduction
This is a simple experimental implementation of a LINQ-like query language for C++ containers. I’ve just started working on it, so it’s still just a toy. Linq++ depends on the Boost C++ library.
Suppose you have an STL container:
struct Person { string name; int age; Person(const string& aName, int anAge) : name(aName), age(anAge) {} }; shared_ptr<vector<Person> > guests;
You can do simple things like:
Count the number of people older than 30
cout << from(guests) .where(&_1 ->* &Person::age > 30) .count()
Find people older than 30 and create a vector with their ages
from(guests) .where(&_1 ->* &Person::age > 30) .select<int>(&_1 ->* &Person::age);
A snippet from the unit tests illustrates its expressivenss:
// combine the people older than 30 with the person with name "joe" into one table. DataSet<vector<Person> > results = insert( from(guests) .where(&_1 ->* &Person::age > 30)) .into( from(guests) .where(&_1 ->* &Person::name == "joe"));// select the age column from the previous table.
shared_ptr<vector> ages = results
.select(&_1 →* &Person::age)
.get();
See the companion unit tests for details.







