Skip to content

snsinfu/cxx14_range_algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

range.hpp

C++14 Boost License Build Status

A single-file, header-only library of C++14 standard algorithms adapted to ranges. range.hpp aims to be a thin wrapper around the standard algorithms. If you need a more comprehensive range library, you may want to use range-v3 instead.

Installation

Copy range.hpp to the include directory of your project. Change file name and/or namespace as you like.

Usage

Include range.hpp and use algorithms in namespace range:

#include <iostream>
#include <iterator>
#include <vector>

#include <range.hpp>

int main()
{
    std::vector<int> numbers {49, 72, 17, 16, 98, 52, 18, 61, 21, 29, 86};
    range::sort(numbers);
    range::copy(numbers, std::ostream_iterator(std::cout, " "));
    std::cout << '\n';
}

Sequence algorithms in algorithm and numeric headers except for random_shuffle are provided.

Testing

Move to the repository root and type following commands to run tests:

mkdir tests/build
cd tests/build
cmake ..
cmake --build .
./run

Tested compilers are:

  • g++ 7
  • clang++ 5.0 with libc++

License

Boost Software License, Version 1.0.

License text is included in the header file. You don't need to copy license file (LICENSE.txt) into your project if you just use the header file.

About

A single-file, header-only library of C++14 standard algorithms adapted to ranges

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published