First of all, I use boost library, and if it changes anything, the code is compiled on a Windows Machine.
The code itself contains a lot more of function acting upon matrices but only this one triggers the error.
Well, I am trying to transform matrix like :
{001
100
010}
To something like :
{1
3
2}
But strangely I can't compile my code and I can't find the error so I would be glad if anyone could help me.
Below the code :
using namespace boost::numeric::ublas;
typedef matrix <float, row_major, unbounded_array<float>> MATRIXf;
MATRIXf matrix_to_class (const MATRIXf inputM)
{
MATRIXf output;
for (std::size_t line = 0; line < inputM.size1(); line++)
{
for (std::size_t column = 0; column < inputM.size2(); column++)
{
if (column == 1)
{
output.insert_element(line,0.0,column);
}
}
}
return output;
}
Here is the error code:
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xutility(2372): error C4996: 'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\xutility(2372): note: see declaration of 'std::copy::_Unchecked_iterators::_Deprecate'
1> e:\c++ libraries\general\boost_1_65_0\boost\numeric\ublas\storage.hpp(204): note: see reference to function template instantiation '_OutIt *std::copy<float*,float*>(_InIt,_InIt,_OutIt)' being compiled
1> with
1> [
1> _OutIt=float *,
1> _InIt=float *
1> ]
1> e:\c++ libraries\general\boost_1_65_0\boost\numeric\ublas\storage.hpp(201): note: while compiling class template member function 'boost::numeric::ublas::unbounded_array<float,std::allocator<T>> &boost::numeric::ublas::unbounded_array<T,std::allocator<T>>::operator =(const boost::numeric::ublas::unbounded_array<T,std::allocator<T>> &)'
1> with
1> [
1> T=float
1> ]
1> e:\c++ libraries\general\boost_1_65_0\boost\numeric\ublas\matrix.hpp(310): note: see reference to function template instantiation 'boost::numeric::ublas::unbounded_array<float,std::allocator<T>> &boost::numeric::ublas::unbounded_array<T,std::allocator<T>>::operator =(const boost::numeric::ublas::unbounded_array<T,std::allocator<T>> &)' being compiled
1> with
1> [
1> T=float
1> ]
1> e:\c++ libraries\general\boost_1_65_0\boost\numeric\ublas\matrix.hpp(102): note: see reference to class template instantiation 'boost::numeric::ublas::unbounded_array<float,std::allocator<T>>' being compiled
1> with
1> [
1> T=float
1> ]
1> g:\c++ python\travail\visualstudio\visualstudio\guigui\neural net\neural net\utils.hpp(21): note: see reference to class template instantiation 'boost::numeric::ublas::matrix<float,boost::numeric::ublas::row_major,boost::numeric::ublas::unbounded_array<float,std::allocator<T>>>' being compiled
1> with
1> [
1> T=float
1> ]
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory(102): error C4996: 'std::uninitialized_copy::_Unchecked_iterators::_Deprecate': Call to 'std::uninitialized_copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory(102): note: see declaration of 'std::uninitialized_copy::_Unchecked_iterators::_Deprecate'
1> e:\c++ libraries\general\boost_1_65_0\boost\numeric\ublas\storage.hpp(94): note: see reference to function template instantiation '_FwdIt *std::uninitialized_copy<const float*,float*>(_InIt,_InIt,_FwdIt)' being compiled
1> with
1> [
1> _FwdIt=float *,
1> _InIt=const float *
1> ]
1> e:\c++ libraries\general\boost_1_65_0\boost\numeric\ublas\storage.hpp(89): note: while compiling class template member function 'boost::numeric::ublas::unbounded_array<float,std::allocator<T>>::unbounded_array(const boost::numeric::ublas::unbounded_array<T,std::allocator<T>> &)'
1> with
1> [
1> T=float
1> ]
1> e:\c++ libraries\general\boost_1_65_0\boost\numeric\ublas\matrix.hpp(162): note: see reference to function template instantiation 'boost::numeric::ublas::unbounded_array<float,std::allocator<T>>::unbounded_array(const boost::numeric::ublas::unbounded_array<T,std::allocator<T>> &)' being compiled
1> with
1> [
1> T=float
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Trying to locate the error brings me to the function above.
Thanks in advance.
Near the end of the first error message is the text, "To disable this warning, use -D_SCL_SECURE_NO_WARNINGS". https://msdn.microsoft.com/en-us/library/ttcz0bys.aspx has a more detailed discussion of warnings and checked iterators. In essence, Microsoft created "safe" mutations of Standard C++ functions to help developers avoid invalid iterator usage. The error message suggests that you define _SCL_SECURE_NO_WARNINGS. This can be done in the project properties C/C++/Preprocessor/Preprocessor Definitions. In a project I worked on in the past, we disabled all the "safe" versions of the functions because of the performance hit.
You may be interested in reading the above Microsoft page for more information about the checked iterator topic.
Related
I'm a c++ beginner. I get this warning message in my code:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xmemory(208): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xmemory(280) : see reference to function template instantiation 'void std::allocator<_Ty>::construct<double&>(int *,_Other)' being compiled
1> with
1> [
1> _Ty=int,
1> _Other=double &
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(668) : see reference to function template instantiation 'void std::_Cons_val<std::allocator<_Ty>,int,double&>(_Alloc &,_Ty1 *,_Ty2)' being compiled
1> with
1> [
1> _Ty=int,
1> _Alloc=std::allocator<int>,
1> _Ty1=int,
1> _Ty2=double &
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(688) : see reference to function template instantiation 'void std::vector<_Ty>::emplace_back<double&>(_Valty)' being compiled
1> with
1> [
1> _Ty=int,
1> _Valty=double &
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(675) : see reference to function template instantiation 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::emplace<double&>(std::_Vector_const_iterator<_Myvec>,_Valty)' being compiled
1> with
1> [
1> _Myvec=std::_Vector_val<int,std::allocator<int>>,
1> _Ty=int,
1> _Valty=double &
1> ]
1> preprocessDoc.cpp(14054) : see reference to function template instantiation 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::insert<double&>(std::_Vector_const_iterator<_Myvec>,_Valty)' being compiled
1> with
1> [
1> _Myvec=std::_Vector_val<int,std::allocator<int>>,
1> _Ty=int,
1> _Valty=double &
1> ]
The code compiles without any error however I want to get rid of this warning. The line where I am getting the warning is:
void PreprocessDoc::AddDisplay(double d_display, int pattern)
{
if(pattern==1)
{
d_displayYT.insert(d_displayYT.end(), d_display); //this line
YTtoYrn();
}
}
Any help would be good
_Myvec=std::_Vector_val<int,std::allocator<int>>,
The compiler is telling you that you're converting a double to int. If the double is say 42.666 what is stored is just 42. It's warning you in case this was not intended.
If that's really what you want then do as David suggests. If it's not then you need to change the type the vector holds.
Change:
d_displayYT.insert(d_displayYT.end(), d_display); //this line
to:
d_displayYT.insert(d_displayYT.end(), static_cast<int>(d_display));
I've inherited some unit test code (VS2008 c++ for a WinCE-based smart device) that uses gtest. When I compile the unit tests I get all kinds of C4800 warnings about forcing ints into bools. What's weird is that the only gtest calls in the module generating the warnings are to EXPECT_STREQ.
Is this a (minor) bug in gtest, it's doing EXPECT_STREQ in a way that confuses VS2008/WinCE?
We are using gtest version 1.6, does anyone know if version 1.7 works for WinCE?
==============
1>C:\googletest\include\gtest/internal/gtest-port.h(1031) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1> C:\googletest\include\gtest/internal/gtest-param-util.h(321) : see reference to function template instantiation 'Derived *testing::internal::CheckedDowncastToActualType<const testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator,const testing::internal::ParamIteratorInterface<T>>(Base *)' being compiled
1> with
1> [
1> Derived=const testing::internal::ValuesInIteratorRangeGenerator<ParamType>::Iterator,
1> T=ParamType,
1> Base=const testing::internal::ParamIteratorInterface<bool>
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util.h(314) : while compiling class template member function 'bool testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator::Equals(const testing::internal::ParamIteratorInterface<T> &) const'
1> with
1> [
1> T=ParamType
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util.h(276) : see reference to class template instantiation 'testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator' being compiled
1> with
1> [
1> T=ParamType
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util.h(275) : while compiling class template member function 'testing::internal::ParamIteratorInterface<T> *testing::internal::ValuesInIteratorRangeGenerator<T>::Begin(void) const'
1> with
1> [
1> T=bool
1> ]
1> C:\googletest\include\gtest/gtest-param-test.h(314) : see reference to class template instantiation 'testing::internal::ValuesInIteratorRangeGenerator<T>' being compiled
1> with
1> [
1> T=ParamType
1> ]
1> C:\googletest\include\gtest/gtest-param-test.h(319) : see reference to function template instantiation 'testing::internal::ParamGenerator<T> testing::ValuesIn<const T*>(ForwardIterator,ForwardIterator)' being compiled
1> with
1> [
1> T=bool,
1> ForwardIterator=const bool *
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util-generated.h(99) : see reference to function template instantiation 'testing::internal::ParamGenerator<T> testing::ValuesIn<T,2>(const T (&)[2])' being compiled
1> with
1> [
1> T=bool
1> ]
1> C:\googletest\include\gtest/gtest-param-test.h(1221) : see reference to function template instantiation 'testing::internal::ValueArray2<T1,T2>::operator testing::internal::ParamGenerator<T>(void) const<bool>' being compiled
1> with
1> [
1> T1=bool,
1> T2=bool,
1> T=bool
1> ]
Warning C4800 is given when an int is put into a variable of type bool. The documentation for warning C4800 states that it is a performance warning so you probably don't have to worry about it.
If you want hide the warning you can use MSVC's #pragma warning(disable:4800) to disable the warning.
So it would look like this
#pragma warning(disable:4800) //Disable the warning
... // Code that gives warning here
#pragma warning(default:4800) //Stop suppressing the warning
You can see the documentation for #pragma warning here.
I am using VS2012 and I have problem with following example:
#include <chrono>
#include <thread>
int main()
{
// doesn't compile and I don't understand why:
std::this_thread::sleep_for(std::chrono::duration<double>(0.1));
// I can use this but still I would like to know the reason:
std::this_thread::sleep_for(std::chrono::duration<long long, std::milli>(100));
return 0;
}
Both duration should be valid. And it is possible to use them in different context.
Compile error:
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\chrono(749): error C2679: binary '+=' : no operator found which takes a right-hand operand of type 'const std::chrono::duration<_Rep>' (or there is no acceptable conversion)
1> with
1> [
1> _Rep=double
1> ]
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\chrono(166): could be 'std::chrono::duration<_Rep,_Period> &std::chrono::duration<_Rep,_Period>::operator +=(const std::chrono::duration<_Rep,_Period> &)'
1> with
1> [
1> _Rep=__int64,
1> _Period=std::nano
1> ]
1> while trying to match the argument list '(std::chrono::nanoseconds, const std::chrono::duration<_Rep>)'
1> with
1> [
1> _Rep=double
1> ]
1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\thread(164) : see reference to function template instantiation 'xtime std::_To_xtime<double,std::ratio<_Nx>>(const std::chrono::duration<_Rep> &)' being compiled
1> with
1> [
1> _Nx=0x01,
1> _Rep=double
1> ]
1> i:\prog\.c++\test2\test2\source.cpp(13) : see reference to function template instantiation 'void std::this_thread::sleep_for<double,std::ratio<_Nx>>(const std::chrono::duration<_Rep> &)' being compiled
1> with
1> [
1> _Nx=0x01,
1> _Rep=double
1> ]
1>
1>Build FAILED.
Any help appreciated.
It is VS2012 compiler issue. Not 100% sure if it is this one (thx Praetorian). But it is possible to compile without problem with gcc 4.9.2. I should've think about trying it before I ask.
This code fails to build in VC2013: (EDIT: I'm not asking why it fails to build)
#include <functional>
struct MyStruct
{
std::function<void()> m_Func;
MyStruct( const std::function<void()>& func) : m_Func(func) {}
};
int main()
{
MyStruct rc( NULL );
return 0;
}
With error:
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xrefwrap(283): error C2064: term does not evaluate to a function taking 0 arguments
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(228) : see reference to function template instantiation '_Ret std::_Callable_obj<int,false>::_ApplyX<_Rx,>(void)' being compiled
1> with
1> [
1> _Ret=void
1> , _Rx=void
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(228) : see reference to function template instantiation '_Ret std::_Callable_obj<int,false>::_ApplyX<_Rx,>(void)' being compiled
1> with
1> [
1> _Ret=void
1> , _Rx=void
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(226) : while compiling class template member function 'void std::_Func_impl<_MyWrapper,_Alloc,_Ret,>::_Do_call(void)'
1> with
1> [
1> _Alloc=std::allocator<std::_Func_class<void,>>
1> , _Ret=void
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(495) : see reference to class template instantiation 'std::_Func_impl<_MyWrapper,_Alloc,_Ret,>' being compiled
1> with
1> [
1> _Alloc=std::allocator<std::_Func_class<void,>>
1> , _Ret=void
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(396) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void
1> , _Ty=int
1> , _Alloc=std::allocator<std::_Func_class<void,>>
1> , _Fty=int
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(396) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void
1> , _Ty=int
1> , _Alloc=std::allocator<std::_Func_class<void,>>
1> , _Fty=int
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(385) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,>>>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void
1> , _Ty=int
1> , _Fty=int
1> , _Alloc=std::allocator<std::_Func_class<void,>>
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(385) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,>>>(_Fty &&,_Alloc)' being compiled
1> with
1> [
1> _Ret=void
1> , _Ty=int
1> , _Fty=int
1> , _Alloc=std::allocator<std::_Func_class<void,>>
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(671) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset<_Ty>(_Fty &&)' being compiled
1> with
1> [
1> _Ret=void
1> , _Ty=int
1> , _Fty=int
1> ]
1> c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(671) : see reference to function template instantiation 'void std::_Func_class<_Ret,>::_Reset<_Ty>(_Fty &&)' being compiled
1> with
1> [
1> _Ret=void
1> , _Ty=int
1> , _Fty=int
1> ]
1> f:\work\teststdfunction\teststdfunction.cpp(16) : see reference to function template instantiation 'std::function<void (void)>::function<int>(_Fx &&)' being compiled
1> with
1> [
1> _Fx=int
1> ]
1> f:\work\teststdfunction\teststdfunction.cpp(16) : see reference to function template instantiation 'std::function<void (void)>::function<int>(_Fx &&)' being compiled
1> with
1> [
1> _Fx=int
1> ]
(Note the '_Fx=int' at the last two reported errors).
I can live with that, as changing MyStruct rc(NULL) to MyStruct rc(nullptr) solves the error. Two things however remain a mystery:
1) Removing the const qualifier from MyStruct ctor (MyStruct( std::function<void()>& func) gives a very, very different error:
1>f:\work\main\dev\common\teststdfunction\teststdfunction\teststdfunction.cpp(16):
error C2664: 'MyStruct::MyStruct(const MyStruct &)' : cannot convert
argument 1 from 'int' to 'std::function &'
Which makes more sense than the original error, and now fixing NULL to nullptr doesn't solve it. Why does int (or nullptr) refuse to cast to std::function<>& but agree to cast to a const std::function<>& ?
2) The original code compiles and works as expected in VS2010. Is it an obscure VS2010 library bug?
EDIT:
As far as the const/non const question goes, I now think the casting involved and potential type mismatch are probably a red herring. The argument passed - either NULL or nullptr - is a literal and thus a const. It just cannot bind to a non const reference. For example:
const int& a = 8; // Ok
int& b = 9; // error C2440: 'initializing' : cannot convert from 'int' to 'int &'
Does that sound right? Am I still missing something?
The special here has to do with constructor template constraints and other implicit conversions.
The reason why nullptr works is because std::function has a particular constructor taking it. This constructor will always be the best match for that argument because function templates are ranked as lower preference, all else being equal.
Normally, 0 will implicitly convert to nullptr and that's fine. The problem is that it can also be passed to the unconstrained function template constructor which constructs from function objects. This does not require an implicit conversion, so all is not equal, so this constructor is preferred- which results in the error that you see that int is not a valid function object.
libstdc++ and libc++ don't not exhibit this behaviour because they have implemented the C++14 fix for this problem, which constrains the constructor. C++11 did not so this behaviour is quite conforming for a C++11 implementation.
This kind of issue is why NULL is a terrible thing that you shouldn't use. In fact, the VS2010 team had to rush nullptr out the door as an additional feature in the last minute because NULL interacts so badly with every other feature in C++, ever, and especially with C++11.
For const vs non-const references, other answers have explained that issue adequately.
There are other WTFs you can find when using std::function without the constrained constructor fix shipped in C++14- this isn't the only one. The long and short is that it's a defect in the C++11 Standard, and not in VS. VS2010 compiling it is probably a compiler overload resolution bug.
Casting a T to a U& never works, and that's intentionally. You can cast to a U const&. The reason is that changes to the temporary U object wouldn't propagate back to the T value.
VS2010 is slightly buggy in this respect, and did allow the cast (but with the proper settings, will warn about it)
I'm getting an error occurring in the 'xutility' class - It is locked as I did not create it
error C2582: 'operator =' function is unavailable in 'Agent'
The error points to these lines in the code:
// TEMPLATE FUNCTION move
template<class _InIt,
class _OutIt> inline
_OutIt _Move(_InIt _First, _InIt _Last,
_OutIt _Dest, _Nonscalar_ptr_iterator_tag)
{ // move [_First, _Last) to [_Dest, ...), arbitrary iterators
for (; _First != _Last; ++_Dest, ++_First)
*_Dest = _STD move(*_First); // this line has the error
return (_Dest);
}
Why is this occurring? What does it mean and how can I fix it?
EDIT - this is what I grabbed from the output, can someone help me understand this? Sorry to be a complete newbie...
1>------ Build started: Project: D3D10DEMO, Configuration: Debug Win32 ------
1> Level.cpp
1>c:\users\asher\documents\my dropbox\direct3d\d3d10demo_1.0\d3d10demo\level.cpp(449): warning C4018: '<' : signed/unsigned mismatch
1> Brain.cpp
1>c:\users\asher\documents\my dropbox\direct3d\d3d10demo_1.0\d3d10demo\brain.cpp(43): warning C4413: 'Brain::nodes' : reference member is initialized to a temporary that doesn't persist after the constructor exits
1> c:\users\asher\documents\my dropbox\direct3d\d3d10demo_1.0\d3d10demo\brain.h(34) : see declaration of 'Brain::nodes'
1>c:\users\asher\documents\my dropbox\direct3d\d3d10demo_1.0\d3d10demo\brain.cpp(43): warning C4413: 'Brain::roomNodeVectors' : reference member is initialized to a temporary that doesn't persist after the constructor exits
1> c:\users\asher\documents\my dropbox\direct3d\d3d10demo_1.0\d3d10demo\brain.h(35) : see declaration of 'Brain::roomNodeVectors'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2514): error C2582: 'operator =' function is unavailable in 'Agent'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2535) : see reference to function template instantiation '_OutIt std::_Move<_InIt,_OutIt> (_InIt,_InIt,_OutIt,std::_Nonscalar_ptr_iterator_tag)' being compiled
1> with
1> [
1> _OutIt=Agent *,
1> _InIt=Agent *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1170) : see reference to function template instantiation '_OutIt std::_Move<Agent*,Agent*>(_InIt,_InIt,_OutIt)' being compiled
1> with
1> [
1> _OutIt=Agent *,
1> _InIt=Agent *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1165) : while compiling class template member function 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::erase(std::_Vector_const_iterator<_Myvec>)'
1> with
1> [
1> _Myvec=std::_Vector_val<Agent,std::allocator<Agent>>,
1> _Ty=Agent
1> ]
1> c:\users\asher\documents\my dropbox\direct3d\d3d10demo_1.0\d3d10demo\brain.h(41) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1> with
1> [
1> _Ty=Agent
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2514): error C2582: 'operator =' function is unavailable in 'Pickup'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2535) : see reference to function template instantiation '_OutIt std::_Move<_InIt,_OutIt>(_InIt,_InIt,_OutIt,std::_Nonscalar_ptr_iterator_tag)' being compiled
1> with
1> [
1> _OutIt=Pickup *,
1> _InIt=Pickup *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1170) : see reference to function template instantiation '_OutIt std::_Move<Pickup*,Pickup*>(_InIt,_InIt,_OutIt)' being compiled
1> with
1> [
1> _OutIt=Pickup *,
1> _InIt=Pickup *
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\vector(1165) : while compiling class template member function 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::erase(std::_Vector_const_iterator<_Myvec>)'
1> with
1> [
1> _Myvec=std::_Vector_val<Pickup,std::allocator<Pickup>>,
1> _Ty=Pickup
1> ]
1> c:\users\asher\documents\my dropbox\direct3d\d3d10demo_1.0\d3d10demo\brain.h(44) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1> with
1> [
1> _Ty=Pickup
1> ]
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
You seem to be calling a function template of the standard library with a type Agent that cannot be move-assigned to, yet the algorithm invoked needs to do just that.
As Als said in a comment to your question, you need to show the code that invokes this algorithm.
Of course you need to provide the agent class.
Assuming C++11, you need to implement
struct Agent
{
// .... other stuff
Agent(Agent&& other) { /* ... */ }
Agent& operator=(Agent&& other) { /* ... */ return *this; }
};
which is known as the Move Assignment operator. While you're at it, you might want to implement the move constructor as they go hand-in-hand:
Agent(Agent&& other) { /* ... */ }
Recommended reading:
http://en.wikipedia.org/wiki/C%2B%2B11#Rvalue_references_and_move_constructors
http://akrzemi1.wordpress.com/2011/08/11/move-constructor/
and many others