Boost C++ Libraries: Ticket #719: problem when using bool type in variant https://svn.boost.org/trac10/ticket/719 <pre class="wiki">when bool is used as a type in variant the stream output does not work as expected. i used the latest cvs sources. example: // works correct boost::variant&lt;int, float, std::string&gt; vari_t; vari_t = "hallo"; std::cout &lt;&lt; vari_t &lt;&lt; std::endl; output: hallo // works not correct boost::variant&lt;int, bool, float, std::string&gt; vari_t; vari_t = "hallo"; std::cout &lt;&lt; vari_t &lt;&lt; std::endl; vari_t = true; std::cout &lt;&lt; vari_t &lt;&lt; std::endl; output: 1 1 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/719 Trac 1.4.3 ebf Tue, 24 Oct 2006 18:34:06 GMT status changed https://svn.boost.org/trac10/ticket/719#comment:1 https://svn.boost.org/trac10/ticket/719#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=120427 This is not a defect; variant uses normal overload resolution. Consider the following program: #include &lt;iostream&gt; #include &lt;string&gt; void f(std::string x) { std::cout &lt;&lt; "string: " &lt;&lt; x &lt;&lt; std::endl; } void f(bool x) { std::cout &lt;&lt; "bool: " &lt;&lt; x &lt;&lt; std::endl; } int main() { f( "hallo" ); f( true ); } This program when run prints the following output: bool: 1 bool: 1 The surprise you are experiencing is that the conversion from char* to bool is considered better than from char* to std::string. Regards, Eric </pre> Ticket