Coder Social home page Coder Social logo

range-v3-vs2015's Introduction

Range-V3-VS2015

This is a fork of Eric Niebler's range-v3 library from late 2015 with extensive (and somewhat invasive) workarounds to support the Visual C++ compiler as released in Microsoft Visual Studio 2015. As MSVC becomes more conforming throughout the VS2017 series, it is our hope that this separate fork will become unnecessary and that it will be possible for upstream range-v3 to support MSVC directly. Given that goal, there is little motivation for diverging development in this fork. (Note that despite the "VS2015" in the title, this library is intended to work with VS2017 as well.)

Please post any problems you have with this codebase in the Github issues forum and not in the upstream range-v3 forum. There's no need to bother the range-v3 maintainers with issues and/or bugs in this two-year-old code that may have already been fixed upstream.

About (excerpted from the upstream README):

Why does C++ need another range library? Simply put, the existing solutions haven't kept up with the rapid evolution of C++. Range v3 is a library for the future C++. Not only does it work well with today's C++ -- move semantics, lambdas, automatically deduced types and all -- it also anticipates tomorrow's C++ with Concepts Lite.

Range v3 forms the basis of a proposal to add range support to the standard library (N4128: Ranges for the Standard Library). It also will be the reference implementation for an upcoming Technical Specification. These are the first steps toward turning ranges into an international standard.

Documentation:

Check out the (woefully incomplete) documentation here.

License:

Most of the source code is under the Boost Software License. Parts are taken from Alex Stepanov's Elements of Programming, LLVM's libc++, and from the SGI STL. Please see the attached LICENSE.txt for the full text of all licenses.

range-v3-vs2015's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

range-v3-vs2015's Issues

ranges::view::empty() causes "Conversion loses qualifiers" error

Hi,

I'm very new to Range v3 so this might be a misunderstanding on my end. Calling remove_if on a constant range and querying the result with empty() causes a build failure on Visual Studio 2015. Here is code that causes this:

std::vector<int> v { 6, 2, 3, 4, 5, 6 };
auto rng = v | ranges::view::remove_if([](int i) {return i>0;});
std::cout << "empty:  " << rng.empty()<< "\n";

The error is quite verbose. I copied it in the file below.

Replacing rng.empty() with rng.begin() == rng.end() makes this error go away.

The same code works on Wandbox using GCC. The version on which I see the problem is the one tagged vcpkg5.

error.log

Performance issue (or misuse)

I'm trying to split stridden data to two components using range-v3. something like this

void foo(Buffer& input, Buffer& U, Buffer& V)
{
    V = ranges::move(input | ranges::v3::view::slice(0ull, input.size()) | ranges::v3::view::stride(2));
    U = ranges::move(input | ranges::v3::view::slice(1ull, input.size()) | ranges::v3::view::stride(2));
}

where the Buffer is defined as std::vector<uint8_t>
For some reason it is very slow, about 20 times slower than naïve for loop. Am I doing something wrong? Is it me or library?
Using VS2015 Upd.3

calendar fails in VS2015 Update 3

Hi,

I build the library using VS2015 Update 3. The library was build without problem. Nonetheless, the calendar example failed.

Now, I'm trying to build the calendar example in my own build system using the following pre-processor and compiler flags:

PREFLAGS = /D "WIN32" /D "_WINDOWS" /D "Boost_USE_STATIC_LIBS=1" \
                     /D "Boost_USE_MULTITHREADED=1" /D "Boost_USE_STATIC_RUNTIME=0"

CGFLAGS=/c /EHsc /W1 /nologo /MTd /std:c++latest

The message that I obtained are very difficult to follow (at least for me).

I really appreciate if you can give me a piece of advice. I'm waiting long time to build the library and learn from it.

Attached, the compiler messages. Thanks a lot.

Regards,

Levis
calendar_compiler_output.txt

concept check for find fails with UDTs

The following code produces a template instantiation error in the concept check before the operator() functions in struct find_fn. Removing the concept check allows the code to compile. The same thing happens in the second example while searching with a compatible/comparable type.

I've attached the error output: range_error.txt

#include <range/v3/all.hpp>
#include <vector>

struct Foo
{
   std::string name;
   friend bool operator==(Foo const& lhs, Foo const& rhs) { return lhs.name == rhs.name; }
};


int main()
{
   auto f = std::vector<Foo>{ {"foo"}, {"bar"}, {"car"}, {"jar"} };
   auto foo = Foo{ "foo" };
   auto it = ranges::find(f, foo);
   it = ranges::find(f.begin(), f.end(), "foo", &Foo::name);

   auto ss = std::vector<std::string>{ "foo", "bar", "car", "jar" };
   auto it2 = ranges::find(ss, "nora");

   return 0;
}

`action::push_back` is a silent no-op rather than compile-time error on incompatible containers

The following snippet was tested with Visual Studio 2017 15.6.6.

#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#include <range/v3/action/push_back.hpp>

#include <set>

int main()
{
    std::set<int> s;
    ranges::action::push_back(s, 1);

    return s.size();
}

This successfully compiles with std:cpp14 or std:cpp17 and returns zero.

Expected behavior is a compile-time error with a static assertion related to std::set not satisfying the concept/ADL detection for push_back.

Oddly, if the first #define is commented out, compilation fails due to the macro not being defined, but also with the expected static assertion.

I am not sure if this is a bug with Range-V3-VS2015 or with MSVC itself. On g++7.2 the code fails at compile time with the expected static assertion failure.

Feature differences with upstream

Which parts of upstream range-v3 are missing in this fork? Everything added since the fork from ericniebler/range-v3@6eb5c83. Roughly, that means:

  • The sample algorithm and view are absent.
  • The range class template hasn't been renamed to iterator_range.
  • None of upstream's changes to the core concepts have been applied, which includes both small semantic changes and more impactful name changes (e.g., IteratorRange<I, S> is now Sentinel<S, I> upstream).
  • The adjacent_filter view is absent.
  • The drop_exactly view is absent.
  • The "set" views (view::set_difference, view::set_intersection, view::set_symmetric_difference, and view::set_union) are absent.

There are also many small differences due to bug fixes and evolution of interfaces that has occurred over the last year in upstream range-v3. I don't have an exhaustive list of those differences, and frankly I'd rather invest time into bringing this library current with upstream range-v3 than extensively investigating and documenting the differences.

Please, if you see any glaring differences while using the library that you think should be brought to the attention of others, post them in this thread and I'll add them to this post.

ranges::view::generate_n with std::reference_wrapper<std::random_device>

I wanted to tinker with ranges and MSVC but the simple demo I wanted to write for myself fails to compile. ranges::view::generate_n works fine with a lambda and does compile with a std::reference_wrapper<std::random_device>, but it asserts during the construction of the range.

AFAIK ref_wrapper should work with random_device, ref_wrapper preserves the functor nature (in the C++ sense) of whatever it is given. This code compiles and works:

using rng = std::random_device;
rng rand_dev;

std::vector<rng::result_type> ints;
std::generate_n(std::back_inserter(ints), 10, std::ref(rand_dev));

for (const auto& i : ints) std::cout << i << " ";
std::cout << std::endl;

So it would only make sense to expect the same kind of behavior when used in range-v3. However...

std::random_device rand_dev;

auto seeds = ranges::view::generate_n(std::ref(rand_dev), 8);

asserts inside range/v3/utility/variant.hpp:249 which is already the body of an active MSVC workaround macro region.

Am I doing something wrong?

internal compiler error on 15.5

I try to build the library on VS 15.5.2 and get a compiler internal error:

 FAILED: test/utility/CMakeFiles/utility.meta.dir/meta.cpp.obj 
  c:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1412~1.258\bin\HostX86\x86\cl.exe  /nologo /TP -D_UNICODE -IF:\Work\Range-V3-VS2015\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /wd4503 /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /Fotest\utility\CMakeFiles\utility.meta.dir\meta.cpp.obj /Fdtest\utility\CMakeFiles\utility.meta.dir\ /FS -c F:\Work\Range-V3-VS2015\test\utility\meta.cpp
F:\Work\Range-V3-VS2015\test\utility\meta.cpp(30): fatal error C1001: An internal error has occurred in the compiler.
  (compiler file 'msc1.cpp', line 1507)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++ 
   Help menu, or open the Technical Support help file for more information
  F:\Work\Range-V3-VS2015\test\utility\meta.cpp(48): note: see reference to function template instantiation 'Ret tc_detail::tuple_cat_<Res,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,3>,std::integral_constant<::size_t,3>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,1>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,1>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,1>,std::tuple<std::tuple<int,short,long> &,std::tuple<> &,std::tuple<float,double,long double> &,std::tuple<void *,char *> &>>(meta::v1::list<std::integral_constant<::size_t,0>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,3>,std::integral_constant<::size_t,3>>,meta::v1::list<std::integral_constant<::size_t,0>,std::integral_constant<::size_t,1>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,1>,std::integral_constant<::size_t,2>,std::integral_constant<::size_t,0>,std::integral_constant<::size_t,1>>,Tuples)' being compiled
          with
          [
              Ret=std::tuple<int,short,long,float,double,long double,void *,char *>,
              Res=std::tuple<int,short,long,float,double,long double,void *,char *>,
              Tuples=std::tuple<std::tuple<int,short,long> &,std::tuple<> &,std::tuple<float,double,long double> &,std::tuple<void *,char *> &>
          ]
  F:\Work\Range-V3-VS2015\test\utility\meta.cpp(58): note: see reference to function template instantiation 'Res tuple_cat<std::tuple<int,short,long>&,std::tuple<>&,std::tuple<float,double,long double>&,std::tuple<void *,char *>&,std::tuple<int,short,long,float,double,long double,void *,char *>>(std::tuple<int,short,long> &,std::tuple<> &,std::tuple<float,double,long double> &,std::tuple<void *,char *> &)' being compiled
          with
          [
              Res=std::tuple<int,short,long,float,double,long double,void *,char *>
          ]
  Internal Compiler Error in c:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1412~1.258\bin\HostX86\x86\cl.exe.  You will be prompted to send an error report to Microsoft later.
  INTERNAL COMPILER ERROR in 'c:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1412~1.258\bin\HostX86\x86\cl.exe'

Should the library work with VS2017?

Some of this stuff seems slightly...out of date

Yes; this fork split off from upstream range-v3 in late July of 2015, at the commit ericniebler/range-v3@6eb5c83 to be precise. There are some recent features missing, and some old bugs outstanding that have been fixed upstream. This library will evolve by gradually downstreaming all range-v3 changes from the intervening months.

Range-V3-VS2017

Are you planning to bring up something that is working with Microsofts VS2017 compiler?

Problems when /permissive- is used

When the /permissive- flag is used (in the current preview of VS2017) there are a couple strange errors. It gets a different type than expected, but this doesn't seem to match any of the affects noted at https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/
and in any case I wouldn't expect better conformance to break more things!

For example, test\view\const.cpp(56) gets common_pair<const int&, const int&> for the result of iter_move(begin(rng3)) when the test expects common_pair<int const&&, int const&&>. In this case, iter_move did not do its job. But look at the previous lines (53,54) where it did work!

Could this repo work with VS2019 of version 16.4.0?

I am trying to build Telegram.sln(with tons of effort to finally get the chance to build), but I immediately gett tons of compile errors:😭

  • error C2039: 'tagged': is not a member of 'std::ranges'
  • Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\set(327): note: see declaration of 'std::ranges
  • error C2977: 'std::tuple_size': too many template arguments
  • etc...

Could you please give me some advices on how to solve it?

Output window:

1>------ Build started: Project: Telegram, Configuration: Debug Win32 ------
1>ninja: Entering directory `..\out\Debug'
1>[1/909] CXX ThirdParty\libtgvoip\libtgvoip.VoIPController.obj
1>C:\TBuild\tdesktop\Telegram\ThirdParty\libtgvoip\VoIPController.cpp(2646): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>[2/909] LIB ThirdParty\libtgvoip\libtgvoip.lib
1>[3/909] CXX sourcefiles\storage\lib_storage.storage_pch.obj
1>FAILED: sourcefiles/storage/lib_storage.storage_pch.obj
1>ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x86\cl.exe" /nologo /showIncludes /FC @sourcefiles\storage\lib_storage.storage_pch.obj.rsp /c ....\Telegram\SourceFiles\storage\storage_pch.cpp /Fosourcefiles\storage\lib_storage.storage_pch.obj /Fdlib_storage.pdb
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(201): error C2039: 'tagged': is not a member of 'std::ranges'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\set(327): note: see declaration of 'std::ranges'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(201): error C2977: 'std::tuple_size': too many template arguments
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(384): note: see declaration of 'std::tuple_size'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(201): error C2988: unrecognizable template declaration/definition
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(201): error C2143: syntax error: missing ';' before '>'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(201): error C2059: syntax error: '>'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(202): error C2065: 'Base': undeclared identifier
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(202): error C2059: syntax error: 'function-style cast'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(203): error C2143: syntax error: missing ';' before '{'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(203): error C2447: '{': missing function header (old-style formal list?)
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(206): error C2039: 'tagged': is not a member of 'std::ranges'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\set(327): note: see declaration of 'std::ranges'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(206): error C2977: 'std::tuple_element': too many template arguments
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\utility(411): note: see declaration of 'std::tuple_element'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(206): error C2988: unrecognizable template declaration/definition
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(206): error C2143: syntax error: missing ';' before '>'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(206): error C2059: syntax error: '>'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(207): error C2065: 'N': undeclared identifier
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(207): error C2065: 'Base': undeclared identifier
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(207): error C2059: syntax error: 'function-style cast'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(208): error C2143: syntax error: missing ';' before '{'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\tagged_pair.hpp(208): error C2447: '{': missing function header (old-style formal list?)
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\compressed_pair.hpp(224): error C2977: 'std::tuple_size': too many template arguments
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\compressed_pair.hpp(223): note: see declaration of 'std::tuple_size'
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\compressed_pair.hpp(230): error C3855: 'std::tuple_element': template parameter '_Index' is incompatible with the declaration
1>C:\TBuild\Libraries\range-v3\include\range\v3\utility\compressed_pair.hpp(236): error C3855: 'std::tuple_element': template parameter '_Index' is incompatible with the declaration
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(420): error C2977: 'std::tuple_size': too many template arguments
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(419): note: see declaration of 'std::tuple_size'
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(426): error C3855: 'std::tuple_element': template parameter '_Index' is incompatible with the declaration
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(432): error C3855: 'std::tuple_element': template parameter '_Index' is incompatible with the declaration
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(437): error C2977: 'std::tuple_size': too many template arguments
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(436): note: see declaration of 'std::tuple_size'
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(443): error C3855: 'std::tuple_element': template parameter '_Index' is incompatible with the declaration
1>C:\TBuild\Libraries\range-v3\include\range\v3\range.hpp(449): error C3855: 'std::tuple_element': template parameter '_Index' is incompatible with the declaration
1>C:\TBuild\Libraries\range-v3\include\meta\meta.hpp(172): error C2794: 'type': is not a member of any direct or indirect base class of 'ranges::v3::concepts::most_refined<meta::v1::listranges::v3::concepts::RandomAccessIncrementable,ranges::v3::concepts::BidirectionalIncrementable,ranges::v3::concepts::Incrementable,ranges::v3::concepts::WeaklyIncrementable,From>'
1> with
1> [
1> From=int
1> ]
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(79): note: see reference to alias template instantiation 'meta::v1::_t<ranges::v3::concepts::most_refined<meta::v1::listranges::v3::concepts::RandomAccessIncrementable,ranges::v3::concepts::BidirectionalIncrementable,ranges::v3::concepts::Incrementable,ranges::v3::concepts::WeaklyIncrementable,From>>' being compiled
1> with
1> [
1> From=int
1> ]
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(84): note: see reference to alias template instantiation 'ranges::v3::incrementable_concept_t' being compiled
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(119): note: see reference to class template instantiation 'ranges::v3::detail::iota_difference' being compiled
1> with
1> [
1> From=int
1> ]
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(119): note: see reference to alias template instantiation 'meta::v1::_t<ranges::v3::detail::iota_difference>' being compiled
1> with
1> [
1> From=int
1> ]
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(304): note: see reference to alias template instantiation 'ranges::v3::detail::iota_difference_t' being compiled
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(517): note: see reference to class template instantiation 'ranges::v3::iota_view<int,void>' being compiled
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(79): error C2938: 'meta::v1::t' : Failed to specialize alias template
1>C:\TBuild\Libraries\range-v3\include\range\v3\view\iota.hpp(115): error C2976: 'ranges::v3::detail::iota_difference
': too few template arguments

ranges::view_facade's cursor incorrectly expects get() method instead of read()

https://github.com/Microsoft/Range-V3-VS2015/blob/7f02ac2acbd068e2bb182f77686a35cbdd51bf59/include/range/v3/range_access.hpp#L364

Original range v3 library (and all examples looks like) expect and use read() method on the cursor.
(see https://github.com/ericniebler/range-v3/blob/c913b630435c784fccb75aeeabc3d2e857dbbee7/include/range/v3/range_access.hpp#L292)

Current library expects get(). Which, is, as you can imagine, was real hard to debug too )

Could you fix it?

VS range doesn't have `make_iterator_range`

VS version of range-v3 doesn't have make_iterator_range, instead it uses make_range (which standard ranges-v3 do not have).

Due to this you can't have crosscompiler code with ranges...

AppVeyor is failing

...since it is using the x86-hosted compilers, and act.split doesn't compile thanks to issue #1. I need to fix #1 and/or force the AppVeyor build to use the x64-hosted compilers.

VS2017?

The front page info still talks of the "VS15" releases as being in the future, so it is out of date. According to that, this repo should not be necessary anymore, as it was reconciled in that line and VS2017 should be able to use the regular branch.

My initial experience is that it DOES NOT. Can you update the README.md file to state the current situation?

And doing so will answer my immediate questions, as to whether I should be using this with VS2017 15.3.0[P4] or not.

VS2017 ICE

#include <range/v3/all.hpp> gives

3>\include\meta/meta.hpp(621): error C2938: 'invoke<T::type>' : Failed to specialize alias template
3>\include\meta/meta.hpp(621): error C2794: 'invoke': is not a member of any direct or indirect base class of 'meta::v1::id<void>'
3>\include\meta/meta.hpp(621): error C2938: 'invoke<meta::v1::id<void>,T::type>' : Failed to specialize alias template
3>\include\meta/meta.hpp(621): error C2938: 'void_<T::type>' : Failed to specialize alias template
3>\include\meta/meta.hpp(624): error C2976: 'meta::v1::detail::is_trait_': too few template arguments
3>\include\meta/meta.hpp(621): note: see declaration of 'meta::v1::detail::is_trait_'
3>\include\meta/meta.hpp(633): error C2938: 'invoke<meta::v1::quote<T::invoke>>' : Failed to specialize alias template
3>\include\meta/meta.hpp(633): error C2794: 'invoke': is not a member of any direct or indirect base class of 'meta::v1::id<void>'
3>\include\meta/meta.hpp(633): error C2938: 'invoke<meta::v1::id<void>,meta::v1::quote<T::invoke>>' : Failed to specialize alias template
3>\include\meta/meta.hpp(633): error C2938: 'void_<meta::v1::quote<T::invoke>>' : Failed to specialize alias template
3>\include\meta/meta.hpp(636): error C2976: 'meta::v1::detail::is_callable_': too few template arguments
3>\include\meta/meta.hpp(633): note: see declaration of 'meta::v1::detail::is_callable_'
3>\include\meta/meta.hpp(667): fatal error C1903: unable to recover from previous error(s); stopping compilation
3>INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\CL.exe'
3>    Please choose the Technical Support command on the Visual C++
3>    Help menu, or open the Technical Support help file for more information

views don't work with std::experimental::generator objects

I was excited to try out the experimental coroutine features in Visual Studio 2017 RC with range v3 to see how well they worked together. I was surprised when it didn't work. It's a bit hard to wade through the machinery for pipeable, pipeable_binder, etc. to tell if this might be on purpose (like the restriction against viewing r-value containers) or an accidental side effect of the concept check or something else.

#include "stdafx.h"

#include <iostream>
#include <experimental/generator>
#include <range/v3/all.hpp>

std::experimental::generator<int> UpTo(int to)
{
   for (auto i = 0; i < to; ++i)
      co_yield i;
}

int main(int argc, char *argv[])
{
   auto generator = UpTo(10);
   for (auto i : generator | ranges::view::remove_if([](auto i) { return i % 2 == 1; }))
      std::cout << i << std::endl;

   return 0;
}

Errors:

Build started ...
test64.cpp
d:\code\test64\test64.cpp(17): error C3312: no callable 'begin' function found for type 'void'
d:\code\test64\test64.cpp(17): error C3312: no callable 'end' function found for type 'void'
d:\code\test64\test64.cpp(17): error C2065: 'i': undeclared identifier
Done building project "test64.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

The generator is an l-value and it's iterator returns an int const&.

The test program in test/action/split.cpp fails to compile

...on the x86-hosted compiler with the error message "fatal error C1060: compiler is out of heap space." Something about this particular test makes the compiler consume memory voraciously. It actually does compile successfully using the x64-hosted compiler after chewing through roughly 6.5GB of RAM.

compile error with remove_if

Hi, I wonder why the following codes give me compile error (VS2015 Update 3):

    std::vector<std::vector<int>> a = { { 1, 2, 3, 4, 5 },{ 1, 2, 3, 4, 5 },{ 1, 2, 3, 4, 5 } };
    std::vector<int> result = a | view::transform([](auto && i) { return i | view::remove_if([](auto && j) { return j % 2; }); }) | view::for_each([](auto && i) { return yield_from(i); });

It gives the errors:

Error C2273 'function-style cast': illegal as right side of '->' operator
Error C2039 '=': is not a member of '`global namespace''

The error disappears if I replace view::remove_if(...) with view::transform(...).

The whole error message is as follows:

1>D:\Range-V3-VS2015\include\range/v3/view/remove_if.hpp(132): error C2273: 'function-style cast': illegal as right side of '->' operator
1> D:\Range-V3-VS2015\include\range/v3/view/remove_if.hpp(131): note: while compiling class template member function 'ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD> &ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD>::operator =(ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD> &&)'
1> with
1> [
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>
1> ]
1> D:\Range-V3-VS2015\include\range/v3/view/join.hpp(112): note: see reference to function template instantiation 'ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD> &ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD>::operator =(ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD> &&)' being compiled
1> with
1> [
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/concepts.hpp(736): note: see reference to class template instantiation 'ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD>' being compiled
1> with
1> [
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/concepts.hpp(228): note: see reference to class template instantiation 'ranges::v3::concepts::models_helper<Concept,Fun,std::vector<int,std::allocator<_Ty>> &>' being compiled
1> with
1> [
1> Concept=ranges::v3::concepts::Function,
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::remove_if_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>>>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\meta/meta.hpp(912): note: see reference to class template instantiation 'ranges::v3::concepts::models<ranges::v3::concepts::Function,Fun,std::vector<int,std::allocator<_Ty>> &>' being compiled
1> with
1> [
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::remove_if_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>>>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\meta/meta.hpp(913): note: see reference to class template instantiation 'meta::v1::detail::and<ranges::v3::concepts::models<ranges::v3::concepts::Function,Fun,std::vector<int,std::allocator<_Ty>> &>>' being compiled
1> with
1> [
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::remove_if_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>>>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/functional.hpp(564): note: see reference to class template instantiation 'meta::v1::detail::and<std::integral_constant<bool,true>,ranges::v3::concepts::models<ranges::v3::concepts::Function,Fun,std::vector<int,std::allocator<_Ty>> &>>' being compiled
1> with
1> [
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::remove_if_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>>>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/concepts.hpp(736): note: see reference to function template instantiation 'ranges::v3::remove_if_view<ranges::v3::range<std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>,std::_Vector_iterator<std::_Vector_val<std::_Simple_types>>>,_Cv_TiD> main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::operator ()<std::vector<int,std::allocator<_Ty>>&>(std::vector<_Ty,std::allocator<_Ty>> &) const' being compiled
1> with
1> [
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>::()::<lambda_87d7eb9c68f8c343fe31ba3cf322bca1>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/concepts.hpp(228): note: see reference to class template instantiation 'ranges::v3::concepts::models_helper<Concept,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>,std::vector<int,std::allocator<_Ty>> &>' being compiled
1> with
1> [
1> Concept=ranges::v3::concepts::Function,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/functional.hpp(1063): note: see reference to class template instantiation 'ranges::v3::concepts::models<ranges::v3::concepts::Function,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>,std::vector<int,std::allocator<_Ty>> &>' being compiled
1> with
1> [
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/concepts.hpp(228): note: see reference to class template instantiation 'ranges::v3::concepts::models_helper<Concept,_Cv_TiD,std::vector<int,std::allocator<_Ty>> &>' being compiled
1> with
1> [
1> Concept=ranges::v3::concepts::Callable,
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\meta/meta.hpp(912): note: see reference to class template instantiation 'ranges::v3::concepts::models<ranges::v3::concepts::Callable,_Cv_TiD,std::vector<int,std::allocator<_Ty>> &>' being compiled
1> with
1> [
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\meta/meta.hpp(913): note: see reference to class template instantiation 'meta::v1::detail::and<ranges::v3::concepts::models<ranges::v3::concepts::Callable,_Cv_TiD,std::vector<int,std::allocator<_Ty>> &>>' being compiled
1> with
1> [
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>,
1> _Ty=int
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\type_traits(1373): note: see reference to class template instantiation 'meta::v1::detail::and<ranges::v3::concepts::models<ranges::v3::concepts::InputRange,std::vector<std::vector<int,std::allocator<_Ty>>,std::allocator<std::vector<_Ty,std::allocator<_Ty>>>> &>,ranges::v3::concepts::models<ranges::v3::concepts::Callable,_Cv_TiD,std::vector<_Ty,std::allocator<_Ty>> &>>' being compiled
1> with
1> [
1> _Ty=int,
1> _Cv_TiD=main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/concepts.hpp(228): note: see reference to class template instantiation 'ranges::v3::concepts::models_helper<Concept,Fun,std::vector<std::vector<int,std::allocator<_Ty>>,std::allocator<std::vector<_Ty,std::allocator<_Ty>>>> &>' being compiled
1> with
1> [
1> Concept=ranges::v3::concepts::Function,
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::transform_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>>>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\meta/meta.hpp(912): note: see reference to class template instantiation 'ranges::v3::concepts::models<ranges::v3::concepts::Function,Fun,std::vector<std::vector<int,std::allocator<_Ty>>,std::allocator<std::vector<_Ty,std::allocator<_Ty>>>> &>' being compiled
1> with
1> [
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::transform_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>>>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\meta/meta.hpp(913): note: see reference to class template instantiation 'meta::v1::detail::and<ranges::v3::concepts::models<ranges::v3::concepts::Function,Fun,std::vector<std::vector<int,std::allocator<_Ty>>,std::allocator<std::vector<_Ty,std::allocator<_Ty>>>> &>>' being compiled
1> with
1> [
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::transform_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>>>,
1> _Ty=int
1> ]
1> D:\Range-V3-VS2015\include\range/v3/utility/functional.hpp(564): note: see reference to class template instantiation 'meta::v1::detail::and<std::integral_constant<bool,true>,ranges::v3::concepts::models<ranges::v3::concepts::Function,Fun,std::vector<std::vector<int,std::allocator<_Ty>>,std::allocator<std::vector<_Ty,std::allocator<_Ty>>>> &>>' being compiled
1> with
1> [
1> Fun=ranges::v3::detail::pipeable_binder<std::_Binder<std::_Unforced,ranges::v3::view::transform_fn &,const std::_Ph<1> &,main::<lambda_5c61e652c8a4e3738a61c19c44bb4810>>>,
1> _Ty=int
1> ]
1>D:\Range-V3-VS2015\include\range/v3/view/remove_if.hpp(132): error C2039: '=': is not a member of '`global namespace''

basic_iterator does not have operator->

std::map<int, std::wstring> ss;
auto rng = ss | ranges::view::values;
auto it = ranges::find_if(rng, [](auto&& x){ x == 10;});
int y = it.base()->first; // this does not compile
// but this OK
// int z = (*(it.base())).first;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.