NuGet has recently added support for native projects. This simplifies a lot deployment of native libraries. Even though cpplinq is not a big library (in fact is just a header file) I have created a NuGet package so that you are able to automatically add it to your project.
Here is what you have to do.
- Make sure you have NuGet 2.5 or newer, otherwise the NuGet package manager won’t show up in your VC++ projects.
- In the context menu for your project choose Manage NuGet Packages…
- Search for cpplinq and install the package.
- Include the cpplinq.hpp header and start using the library. Here is a sample to test that everything is all right.
#include "cpplinq.hpp" void computes_a_sum () { using namespace cpplinq; int ints[] = {3,1,4,1,5,9,2,6,5,4}; auto result = from_array (ints) >> where ([](int i) {return i%2 ==0;}) // Keep only even numbers >> sum () // Sum remaining numbers ; }
Notice that all the settings for library (such as adding the proper entry for the include directories or defining NOMINMAX so that min and max macros will not be defined for the project) are automatically performed, so you can focus on coding.