Boost C++ Libraries: Ticket #9329: Compilation fixes for Sun CC and its ancient standard library https://svn.boost.org/trac10/ticket/9329 <p> This patch avoids the following errors when compiling the library using Sun CC (Sun C++ 5.10 SunOS_i386 2009/06/03): </p> <pre class="wiki">"libs/program_options/src/options_description.cpp", line 422: Error, nomatchoverin: Could not find a match for std::count&lt;std::_InputIterator, std::_T, std::_Size&gt;(char*, char*, char) needed in::format_paragraph(std::ostream &amp;, std::string, unsigned, unsigned). "libs/program_options/src/options_description.cpp", line "libs/program_options/src/options_description.cpp", line 483: Error, toofewtargs: Too few arguments for template std::reverse_iterator. "/opt/sunstudio12.1/prod/include/CC/Cstd/rw/iterator", line 426: Error, nofunctmpl: "friend" declaration is incompatible with function template. "libs/program_options/src/options_description.cpp", line 483: Where, temwhilespec: While specializing "std::reverse_iterator&lt;const char*&gt;". "libs/program_options/src/options_description.cpp", line 483: Where, temspecend: Specialized in non-template code. "libs/program_options/src/options_description.cpp", line 484: Error, toofewtargs: Too few arguments for template std::reverse_iterator. 472: Error, nomatchoverin: Could not find a match for std::distance&lt;std::_ForwardIterator, std::_Distance&gt;(const char*, const char*const) needed in::format_paragraph(std::ostream &amp;, std::string, unsigned, unsigned). "libs/program_options/src/value_semantic.cpp", line 371: Error, nomatchoverin: Could not find a match for std::vector&lt;std::string&gt;::vector(__rwstd::__rb_tree&lt;std::string, std::string, __rwstd::__ident&lt;std::string, std::string&gt;, std::less&lt;std::string&gt;, std::allocator&lt;std::string&gt;&gt;::const_iterator, __rwstd::__rb_tree&lt;std::string, std::string, __rwstd::__ident&lt;std::string, std::string&gt;, std::less&lt;std::string&gt;, std::allocator&lt;std::string&gt;&gt;::const_iterator) needed in boost::program_options::ambiguous_option::substitute_placeholders(const std::string &amp;) const. </pre><p> I don't really understand neither of them, unfortunately: looking at the standard library headers both the calls to <code>count()</code> and <code>distance()</code> should compile. OTOH neither of them is really necessary so I hope this patch can be applied nevertheless. With <code>reverse_iterator</code> it's more mysterious but, again, IMHO its use in the original code is not really needed, so I've just replaced it with <code>rfind()</code>. </p> <p> The last error is clear: this compiler standard library doesn't provide template ctor of <code>std::vector</code> from an iterator pair, so an alternative method of constructing it must be used. This does make the code less concise and elegant, but unfortunately I don't see any other way to make it work in this case. </p> <p> TIA! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9329 Trac 1.4.3 vz-boost@… Wed, 30 Oct 2013 23:23:32 GMT attachment set https://svn.boost.org/trac10/ticket/9329 https://svn.boost.org/trac10/ticket/9329 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">suncc_po.diff</span> </li> </ul> <p> Proposed patch to fix the build with Sun CC </p> Ticket