Note that there are some explanatory texts on larger screens.

plurals
  1. POincorrect result for std::is_trivially_constructible<T, T&>::value when T declared T::T(T&)
    text
    copied!<p>This is a little problem that I get confused with, I don't know how to describe it, so just see the codes below:</p> <pre><code>struct B { B() {} B(B&amp;) { std::cout &lt;&lt; "not trivial\n"; } }; int main() { B b1; B b2(b1); std::cout &lt;&lt; std::is_trivially_constructible&lt;B, B&amp;&gt;::value &lt;&lt; '\n'; return 0; } </code></pre> <p>the output is:</p> <pre><code>not trivial 1 </code></pre> <p>I'm using VS11.</p> <p><strong>EDIT:</strong></p> <p>I just tested the example in <a href="http://en.cppreference.com/w/cpp/types/is_constructible" rel="nofollow">http://en.cppreference.com/w/cpp/types/is_constructible</a> some of the output is incorrect.</p> <pre><code>#include &lt;iostream&gt; #include &lt;type_traits&gt; class Foo { int v1; double v2; public: Foo(int n) : v1(n), v2() {} Foo(int n, double f) : v1(n), v2(f) {} }; int main() { std::cout &lt;&lt; "Foo is ...\n" &lt;&lt; std::boolalpha &lt;&lt; "\tTrivially-constructible from const Foo&amp;? " &lt;&lt; std::is_trivially_constructible&lt;Foo, const Foo&amp;&gt;::value &lt;&lt; '\n' &lt;&lt; "\tTrivially-constructible from int? " &lt;&lt; std::is_trivially_constructible&lt;Foo, int&gt;::value &lt;&lt; '\n' &lt;&lt; "\tConstructible from int? " &lt;&lt; std::is_constructible&lt;Foo, int&gt;::value &lt;&lt; '\n' } </code></pre> <p>the output is:</p> <pre><code>Foo is ... Trivially-constructible from const Foo&amp;? true Trivially-constructible from int? true//Trivially-constructible from int? false Constructible from int? true Press any key to continue . . . </code></pre>
 

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