Note that there are some explanatory texts on larger screens.

plurals
  1. POSTL operator= behavior change with Visual Studio 2010?
    primarykey
    data
    text
    <p>I am attempting to compile QtScriptGenerator (<a href="http://qt.gitorious.org/qt-labs/qtscriptgenerator" rel="nofollow noreferrer" title="QtScriptGenerator gitorious">gitorious</a>) with Visual Studio 2010 (C++) and have run into a compile error. In searching for a solution, I have seen occasional references to compile breakages introduced since VS2008 due to changes in VS2010's implementation of STL and/or c++0x conformance changes.</p> <p>Any ideas what is happening below, or how I could go about fixing it? If the offending code appeared to be QtScriptGenerator's, I think I would have an easier time fixing it.. but it appears to me that the offending code may be in VS2010's STL implementation and I may be required to create a workaround?</p> <p>PS. I am pretty unfamiliar with templates and STL. I have a background in embedded and console projects where such things have until recently often been avoided to reduce memory consumption and cross-compiler risks.</p> <p>Edit - It appears it is probably Visual Studio's implementation of <strong>std::copy</strong> which changed.</p> <pre><code> 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&lt;_Container&gt;' (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&lt;_Container&gt; &amp;rpp::pp_output_iterator&lt;_Container&gt;::operator =(const char &amp;)' with [ _Container=std::string ] while trying to match the argument list '(rpp::pp_output_iterator&lt;_Container&gt;, rpp::pp_output_iterator&lt;_Container&gt;)' with [ _Container=std::string ] C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(2176) : see reference to function template instantiation '_Iter &amp;std::_Rechecked&lt;_OutIt,_OutIt&gt;(_Iter &amp;,_UIter)' being compiled with [ _Iter=rpp::pp_output_iterator&lt;std::string&gt;, _OutIt=rpp::pp_output_iterator&lt;std::string&gt;, _UIter=rpp::pp_output_iterator&lt;std::string&gt; ] c:\qt\qtscriptgenerator\generator\parser\rpp\pp-internal.h(83) : see reference to function template instantiation '_OutIt std::copy&lt;std::_String_iterator&lt;_Elem,_Traits,_Alloc&gt;,_OutputIterator&gt;(_InIt,_InIt,_OutIt)' being compiled with [ _OutIt=rpp::pp_output_iterator&lt;std::string&gt;, _Elem=char, _Traits=std::char_traits&lt;char&gt;, _Alloc=std::allocator&lt;char&gt;, _OutputIterator=rpp::pp_output_iterator&lt;std::string&gt;, _InIt=std::_String_iterator&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt;&gt; ] c:\qt\qtscriptgenerator\generator\parser\rpp\pp-engine-bits.h(500) : see reference to function template instantiation 'void rpp::_PP_internal::output_line&lt;_OutputIterator&gt;(const std::string &amp;,int,_OutputIterator)' being compiled with [ _OutputIterator=rpp::pp_output_iterator&lt;std::string&gt; ] C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(275) : error C2582: 'operator =' function is unavailable in 'rpp::pp_output_iterator&lt;_Container&gt;' with [ _Container=std::string ] </code></pre> <p>Here's some context..</p> <h2>pp-internal.h</h2> <pre><code>#ifndef PP_INTERNAL_H #define PP_INTERNAL_H #include &lt;algorithm&gt; #include &lt;stdio.h&gt; namespace rpp { namespace _PP_internal { .. 64 template &lt;typename _OutputIterator&gt; 65 void output_line(const std::string &amp;__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 += "&lt;internal&gt;"; 79 else 80 __msg += __filename; 81 82 __msg += "\"\n"; 83 std::copy (__msg.begin (), __msg.end (), __result); 84 } </code></pre> <h2>pp-engine-bits.h</h2> <pre><code>#ifndef PP_ENGINE_BITS_H #define PP_ENGINE_BITS_H #include &lt;stdio.h&gt; namespace rpp { 450 template &lt;typename _InputIterator, typename _OutputIterator&gt; 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 } </code></pre> <p>.. and here's the definition of <strong>pp_output_iterator</strong></p> <h2>pp-iterator.h</h2> <pre><code>#ifndef PP_ITERATOR_H #define PP_ITERATOR_H #include &lt;iterator&gt; namespace rpp { .. template &lt;typename _Container&gt; class pp_output_iterator : public std::iterator&lt;std::output_iterator_tag, void, void, void, void&gt; { std::string &amp;_M_result; public: explicit pp_output_iterator(std::string &amp;__result): _M_result (__result) {} inline pp_output_iterator &amp;operator=(typename _Container::const_reference __v) { if (_M_result.capacity () == _M_result.size ()) _M_result.reserve (_M_result.capacity () &lt;&lt; 2); _M_result.push_back(__v); return *this; } inline pp_output_iterator &amp;operator * () { return *this; } inline pp_output_iterator &amp;operator ++ () { return *this; } inline pp_output_iterator operator ++ (int) { return *this; } }; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload