0

i found range-v3 library and i was trying to follow examples in https://ericniebler.github.io/range-v3/index.html

i'm using visual studio 2019 and i installed range-v3 library via vcpkg but... i can't find any functions in ranges::views nameaspace. what is problem???

in empty project, i added /std:c++latest /permissive- and /experimental:preprocessor in command line option, and i included range/v3/all.hpp. anything i missed???

std::vector<int> const vi{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
using namespace ranges;
auto rng = vi | views::remove_if([](int i) { return i % 2 == 1; }) // ican't find remove_if function
    | views::transform([](int i) { return std::to_string(i); });
// rng == {"2","4","6","8","10"};
return 0;
Orcinus
  • 11
  • 2

2 Answers2

0

Because vcpkg ships an earlier version of range-v3, which puts things in ranges::view namespace. There are a number of other differences besides. Refer to the docs that ship with the version in vcpkg, and good luck.

Eric Niebler
  • 5,927
  • 2
  • 29
  • 43
0

vcpkg is a nice idea but most ports are outdated by a couple of months: boost, fmt, range-v3...

Just manually download the current release from Eric's github page and set the path to the include folder - you don't need vcpkg for header-only-libraries.

Porsche9II
  • 629
  • 5
  • 17