Given two objects, <font face="courier new, monospace">one</font> and <font face="courier new, monospace">two</font> that are references to some pure virtual type <font face="courier new, monospace">MyType</font>, the following code compiles fine:<div>
<br></div><div><div><div><font face="courier new, monospace"> std::pair<std::reference_wrapper<MyType>,std::reference_wrapper<
MyType >> mypair = std::make_pair(std::ref(one), std::ref(two));</font></div><div><font face="courier new, monospace"> std::swap(mypair.first, mypair.second);</font></div></div><div><br></div><div>But if I replace the declaration of the pair object type with 'auto' as in:</div>
<div><br></div><div><div><font face="courier new, monospace"> auto mypair = std::make_pair(std::ref(one), std::ref(two));</font></div><br class="Apple-interchange-newline"></div><div>I get the following errors with std::swap:</div>
</div><div><br></div><div><div><font face="courier new, monospace">GameController.cpp:43:9: error: no matching function for call to 'swap'</font></div><div><font face="courier new, monospace"> std::swap(mypair.first, mypair.second);</font></div>
<div><font face="courier new, monospace"> ^~~~~~~~~</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/type_traits:2902:5: note: candidate template ignored: disabled by 'enable_if' [with _Tp = MyType]</font></div>
<div><font face="courier new, monospace"> is_move_constructible<_Tp>::value &&</font></div><div><font face="courier new, monospace"> ^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/utility:185:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/utility:412:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/tuple:220:6: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)</font></div><div><font face="courier new, monospace"> ^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/tuple:751:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/memory:2440:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/memory:2928:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {__x.swap(__y);}</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/memory:4862:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/memory:5151:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/array:279:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/__bit_reference:86:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/__bit_reference:96:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/__bit_reference:106:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/__split_buffer:644:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/vector:3163:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y)</font></div><div><font face="courier new, monospace">^</font></div><div><font face="courier new, monospace">/usr/include/c++/v1/functional:1492:1: note: candidate template ignored: failed template argument deduction</font></div>
<div><font face="courier new, monospace">swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT</font></div><div><font face="courier new, monospace">^</font></div></div><div>
<br></div><div>Is this a bug?</div><div><br></div>