
26 Oct
2009
26 Oct
'09
8:01 p.m.
I've noticed boost::shared_ptr and other classes avoid using inline friend functions, e.g. operator < in class shared_ptr scope: public: template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const { return pn < rhs.pn; } in namespace scope: template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) { return a._internal_less(b); } what's wrong with template<class Y> friend bool operator<(shared_ptr<Y> const & rhs) const { return pn < rhs.pn; } in class shared_ptr? compiler compatibility? other reasons? should boost libraries avoid inline friend functions in general?