I am trying to compile QtScriptGenerator ( gitorious ) with Visual Studio 2010 (C ++) and have encountered a compilation error. When searching for a solution, I saw random links to compile the partitions introduced after VS2008 due to changes in the VS2010 implementation, changes to the STL and / or C ++ 0x compliance.
Any ideas what is going on below, or how can I fix this? If the violation code turned out to be QtScriptGenerator, I think it would be easier for me to fix it .. but it seems to me that the violation code may be in the VS2010 STL implementation, and I may need to create a workaround?
PS. I am pretty new to templates and STL. I have experience in embedded and console projects where so far such things have still been often avoided so as to reduce memory consumption and cross-compiler risks.
Change It looks like this was probably implemented in Visual Studio with the replacement of std :: copy .
C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(275) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'rpp::pp_output_iterator<_Container>' (or there is no acceptable conversion) with [ _Container=std::string ] c:\qt\qtscriptgenerator\generator\parser\rpp\pp-iterator.h(75): could be 'rpp::pp_output_iterator<_Container> &rpp::pp_output_iterator<_Container>::operator =(const char &)' with [ _Container=std::string ] while trying to match the argument list '(rpp::pp_output_iterator<_Container>, rpp::pp_output_iterator<_Container>)' with [ _Container=std::string ] C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(2176) : see reference to function template instantiation '_Iter &std::_Rechecked<_OutIt,_OutIt>(_Iter &,_UIter)' being compiled with [ _Iter=rpp::pp_output_iterator<std::string>, _OutIt=rpp::pp_output_iterator<std::string>, _UIter=rpp::pp_output_iterator<std::string> ] c:\qt\qtscriptgenerator\generator\parser\rpp\pp-internal.h(83) : see reference to function template instantiation '_OutIt std::copy<std::_String_iterator<_Elem,_Traits,_Alloc>,_OutputIterator>(_InIt,_InIt,_OutIt)' being compiled with [ _OutIt=rpp::pp_output_iterator<std::string>, _Elem=char, _Traits=std::char_traits<char>, _Alloc=std::allocator<char>, _OutputIterator=rpp::pp_output_iterator<std::string>, _InIt=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>> ] c:\qt\qtscriptgenerator\generator\parser\rpp\pp-engine-bits.h(500) : see reference to function template instantiation 'void rpp::_PP_internal::output_line<_OutputIterator>(const std::string &,int,_OutputIterator)' being compiled with [ _OutputIterator=rpp::pp_output_iterator<std::string> ] C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(275) : error C2582: 'operator =' function is unavailable in 'rpp::pp_output_iterator<_Container>' with [ _Container=std::string ]
Here is the context ..
pp-internal.h
#ifndef PP_INTERNAL_H #define PP_INTERNAL_H #include <algorithm> #include <stdio.h> namespace rpp { namespace _PP_internal { .. 64 template <typename _OutputIterator> 65 void output_line(const std::string &__filename, int __line, _OutputIterator __result) 66 { 67 std::string __msg; 68 69 __msg += "# "; 70 71 char __line_descr[16]; 72 pp_snprintf (__line_descr, 16, "%d", __line); 73 __msg += __line_descr; 74 75 __msg += " \""; 76 77 if (__filename.empty ()) 78 __msg += "<internal>"; 79 else 80 __msg += __filename; 81 82 __msg += "\"\n"; 83 std::copy (__msg.begin (), __msg.end (), __result); 84 }
pp-engine-bits.h
#ifndef PP_ENGINE_BITS_H #define PP_ENGINE_BITS_H #include <stdio.h> namespace rpp { 450 template <typename _InputIterator, typename _OutputIterator> 451 void pp::operator () (_InputIterator __first, _InputIterator __last, _OutputIterator __result) 452 { .. 497 if (env.current_line != was) 498 { 499 env.current_line = was; 500 _PP_internal::output_line (env.current_file, env.current_line, __result); 501 }
.. and here is the definition of pp_output_iterator
pp-iterator.h
#ifndef PP_ITERATOR_H #define PP_ITERATOR_H #include <iterator> namespace rpp { .. template <typename _Container> class pp_output_iterator : public std::iterator<std::output_iterator_tag, void, void, void, void> { std::string &_M_result; public: explicit pp_output_iterator(std::string &__result): _M_result (__result) {} inline pp_output_iterator &operator=(typename _Container::const_reference __v) { if (_M_result.capacity () == _M_result.size ()) _M_result.reserve (_M_result.capacity () << 2); _M_result.push_back(__v); return *this; } inline pp_output_iterator &operator * () { return *this; } inline pp_output_iterator &operator ++ () { return *this; } inline pp_output_iterator operator ++ (int) { return *this; } };