2bbb / ofxRangeV3

range-v3 porting
Boost Software License 1.0
2 stars 2 forks source link

Conditional import range-v3 when std::ranges exists #2

Open funatsufumiya opened 6 hours ago

funatsufumiya commented 6 hours ago

https://github.com/2bbb/ofxRangeV3/pull/1 PR solves conflicting namspaces, by specifying namespace after include, but it would be smarter to use conditional import range-v3 when std::ranges exists (in C++20 envronment).

funatsufumiya commented 6 hours ago

I created branch for this, but this causes error: expected ‘auto’ or ‘decltype(auto)’ after ‘view’. https://github.com/funatsufumiya/ofxRangeV3/tree/dev

/home/fu/dev/of_v0.12.0_linux64gcc6_release/addons/ofxRangeV3/ofxRangeV3Example/src/ofApp.cpp:15:43: error: expected ‘auto’ or ‘decltype(auto)’ after ‘view’
   15 |             std::vector<int> xs = ranges::view::ints(1, 6) | ranges::view::transform([] (int x) {
      |                                           ^~~~
/home/fu/dev/of_v0.12.0_linux64gcc6_release/addons/ofxRangeV3/ofxRangeV3Example/src/ofApp.cpp:15:43: error: ‘template<class _Tp> concept std::ranges::view’ used without template arguments
/home/fu/dev/of_v0.12.0_linux64gcc6_release/addons/ofxRangeV3/ofxRangeV3Example/src/ofApp.cpp:15:70: error: expected ‘auto’ or ‘decltype(auto)’ after ‘view’
   15 |             std::vector<int> xs = ranges::view::ints(1, 6) | ranges::view::transform([] (int x) {
      |                                                                      ^~~~
/home/fu/dev/of_v0.12.0_linux64gcc6_release/addons/ofxRangeV3/ofxRangeV3Example/src/ofApp.cpp:15:70: error: ‘template<class _Tp> concept std::ranges::view’ used without template arguments
make[1]: *** [../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:217: obj/linux64/Release/src/ofApp.o] Error 1
make[1]: Leaving directory '/home/fu/dev/of_v0.12.0_linux64gcc6_release/addons/ofxRangeV3/ofxRangeV3Example'
make: *** [../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2
funatsufumiya commented 6 hours ago

Considering these subtle differences, it may be safer to fall back to ranges-v3 with the namespace clarification (#1).