21 Sep
2014
21 Sep
'14
5:17 p.m.
Benedek Thaler
On Sat, Sep 20, 2014 at 5:03 PM, Louis Dionne
wrote: [...] I'm not sure what Niall is referring to, but namespaces come into handy when using the swap trick described in effective STL:
template<typename T> library_function(T& a, T& b) { using std::swap; swap(a,b); // will use specialized swap in namespace of T if available }
Yes, ADL can prove itself useful. However, Hana uses tag dispatching like Boost.Fusion and Boost.MPL for customization because it deals with objects of heterogeneous types. Since the actual C++ type of some objects can be impossible or very cumbersome to pattern match, I don't think ADL is the right way to go in our case. Regards, Louis