range-v3 icon indicating copy to clipboard operation
range-v3 copied to clipboard

range-v3 and boost

Open fhelen opened this issue 3 years ago • 6 comments

Hello, Firstly thanks for your great job; I'am trying to use range and boost (boost/algorithm/string.hpp) inside a project. But i'm dealing compiling errors like: /usr/include/boost/range/mutable_iterator.hpp:40:12: error: redeclared with 1 template parameter 40 | struct range_mutable_iterator : range_detail::extract_iterator<C> | ^~~~~~~~~~~~~~~~~~~~~~ In file included from /home/fhelen/vcpkg/packages/range-v3_x64-linux/include/range/v3/view/ref.hpp:116, from /home/fhelen/vcpkg/packages/range-v3_x64-linux/include/range/v3/view/all.hpp:26, from /home/fhelen/vcpkg/packages/range-v3_x64-linux/include/range/v3/view/split.hpp:31, from /home/fhelen/vcpkg/packages/range-v3_x64-linux/include/range/v3/action/split.hpp:30, from /home/fhelen/vcpkg/packages/range-v3_x64-linux/include/range/v3/action.hpp:32, from /home/fhelen/vcpkg/packages/range-v3_x64-linux/include/range/v3/all.hpp:17, from /home/fhelen/workspace/neuralNetwork/test/trainingTest.cpp:2: /home/fhelen/vcpkg/packages/range-v3_x64-linux/include/range/v3/detail/satisfy_boost_range.hpp:29:12: note: previous declaration ‘template<class T, class U> struct boost::range_mutable_iterator’ used 2 template parameters

Is there way to use both range-v3 and boost inside same project? Thanks by advance Florian dbg.txt

fhelen avatar Sep 25 '20 10:09 fhelen

What version of Boost are you using? Range-v3 forward declares some of Boost.Ranges's templates. It's possible Boost.Range has changed recently.

ericniebler avatar Sep 25 '20 15:09 ericniebler

Hello, I'm using boost 1.53 on centos 7; I'm using GCC-9 and C++-17; I think, it's quite old version; Florain

fhelen avatar Sep 25 '20 15:09 fhelen

Notably, the README.md does not specify Requirements. I realized boost is required when 97% of the code was compiled and then it failed.

/usr/bin/ld: cannot find -lBoost::date_time
/usr/bin/ld: cannot find -lBoost::program_options
collect2: error: ld returned 1 exit status
make[2]: *** [example/CMakeFiles/calendar.dir/build.make:95: example/calendar] Error 1
make[1]: *** [CMakeFiles/Makefile2:10253: example/CMakeFiles/calendar.dir/all] Error 2
make: *** [Makefile:139: all] Error 2

mmokrejs avatar Feb 13 '21 12:02 mmokrejs

That's actually unrelated to this issue. See #1287. You can use range-v3 without boost. Just don't attempt to compile that example. The original issue is about a mismatch between what range-v3 expects from a boost template and what an old boost version provides when you actually have boost.

JohelEGP avatar Feb 13 '21 17:02 JohelEGP

I don't need Boost Range compatibility, so I worked around this as follows:

#define RANGES_V3_DETAIL_SATISFY_BOOST_RANGE_HPP
#define RANGES_SATISFY_BOOST_RANGE(view_name)
#include <range/v3/all.hpp>

It would be great to have a supported way to opt out of Boost-related stuff.

joelnn avatar Sep 29 '23 14:09 joelnn

I'm using a custom boost namespace, but ranges-v3 is harcoded to use boost instead of the proper BOOST_EXTENSION_NAMESPACE.

.../external/range-v3-0.12.0/include/range/v3/detail/satisfy_boost_range.hpp:24:11: error: namespace alias 'boost' not allowed here, assuming 'boost_1_79_0'
   24 | namespace boost
      |           ^~~~~

TheClonerx avatar Dec 20 '23 20:12 TheClonerx