Created
March 1, 2012 05:43
-
-
Save eiennohito/1947603 to your computer and use it in GitHub Desktop.
VC++11 compiler error when using boost::range::adaptors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TestApp.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
#include <conio.h> | |
#include <functional> | |
#include <boost/range/algorithm/copy.hpp> | |
#include <boost/range/irange.hpp> | |
#include <boost/range/adaptor/transformed.hpp> | |
#include <vector> | |
namespace ph { | |
using namespace std::placeholders; | |
} | |
class X { | |
public: | |
size_t func(int i) const { return i * 2; } | |
}; | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
using namespace boost::adaptors; | |
std::vector<size_t> vec; | |
X x; | |
std::function<size_t (int)> fnc = std::bind(&X::func, x, ph::_1); | |
boost::copy( | |
boost::irange<const size_t>(1, 15, 2) | | |
transformed( | |
// | |
fnc | |
), | |
std::back_inserter(vec)); | |
std::ostream_iterator<size_t> it(std::cout, " "); | |
std::copy(vec.begin(), vec.end(), it); | |
_getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1>------ Build started: Project: TestApp, Configuration: Debug Win32 ------
1> TestApp.cpp
1> Unknown compiler version - please run the configure tests and report the results
1>f:\lib\include\boost\iterator\transform_iterator.hpp(136): error C3849: function-style call on an expression of type 'const std::_Bind<_Forced,_Ret,_Fun,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t,>' would lose const and/or volatile qualifiers for all 2 available operator overloads
1> with
1> [
1> _Forced=true,
1> _Ret=size_t,
1> _Fun=std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,
1> _V0_t=X &,
1> _V1_t=std::_Ph<1> &,
1> _V2_t=std::_Nil,
1> _V3_t=std::_Nil,
1> _V4_t=std::_Nil,
1> _V5_t=std::_Nil,
1> =std::_Nil
1> ]
1> f:\lib\include\boost\iterator\transform_iterator.hpp(136) : while compiling class template member function 'unsigned int boost::transform_iterator<UnaryFunc,Iterator>::dereference(void) const'
1> with
1> [
1> UnaryFunc=std::_Bind<true,size_t,std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,X &,std::_Ph<1> &,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,
1> Iterator=boost::range_detail::integer_iterator_with_step
1> ]
1> f:\program files\microsoft visual studio 11.0\vc\include\xutility(362) : see reference to class template instantiation 'boost::transform_iterator<UnaryFunc,Iterator>' being compiled
1> with
1> [
1> UnaryFunc=std::_Bind<true,size_t,std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,X &,std::_Ph<1> &,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,
1> Iterator=boost::range_detail::integer_iterator_with_step
1> ]
1> f:\lib\include\boost\detail\iterator.hpp(83) : see reference to class template instantiation 'std::iterator_traits<_Iter>' being compiled
1> with
1> [
1> _Iter=boost::transform_iterator<std::_Bind<true,size_t,std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,X &,std::_Ph<1> &,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,boost::range_detail::integer_iterator_with_step>
1> ]
1> f:\lib\include\boost\iterator\iterator_traits.hpp(30) : see reference to class template instantiation 'boost::detail::iterator_traits' being compiled
1> with
1> [
1> Iterator=boost::transform_iterator<std::_Bind<true,size_t,std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,X &,std::_Ph<1> &,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,boost::range_detail::integer_iterator_with_step>
1> ]
1> f:\lib\include\boost\range\iterator_range_core.hpp(121) : see reference to class template instantiation 'boost::iterator_value' being compiled
1> with
1> [
1> Iterator=boost::transform_iterator<std::_Bind<true,size_t,std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,X &,std::_Ph<1> &,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,boost::range_detail::integer_iterator_with_step>
1> ]
1> f:\lib\include\boost\range\adaptor\transformed.hpp(31) : see reference to class template instantiation 'boost::iterator_range' being compiled
1> with
1> [
1> IteratorT=boost::transform_iterator<std::_Bind<true,size_t,std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,X &,std::_Ph<1> &,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,boost::range_detail::integer_iterator_with_step>
1> ]
1> e:\programming\c++\vs11\testapp\testapp\testapp.cpp(33) : see reference to class template instantiation 'boost::range_detail::transformed_range<F,R>' being compiled
1> with
1> [
1> F=std::_Bind<true,size_t,std::_Pmf_wrap<size_t (__thiscall X::* )(int) const,size_t,X,int,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,X &,std::_Ph<1> &,std::_Nil,std::_Nil,std::_Nil,std::_Nil,std::_Nil>,
1> R=const boost::strided_integer_range
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========