Boost logo

Boost :

Subject: [boost] [config] [random] usage of BOOST_NO_MEMBER_TEMPLATE_FRIENDS
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-02-06 16:19:25


AMDG

Boost.Random uses BOOST_NO_MEMBER_TEMPLATE_FRIENDS to decide
whether it is safe to define the stream operators.

#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) &&
!defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
  template<class CharT, class Traits>
  friend std::basic_ostream<CharT,Traits>&
  operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int& ud);

  template<class CharT, class Traits>
  friend std::basic_istream<CharT,Traits>&
  operator>>(std::basic_istream<CharT,Traits>& is, uniform_int& ud);
#endif

However, the documentation of BOOST_NO_MEMBER_TEMPLATE_FRIENDS
says that BOOST_NO_MEMBER_TEMPLATE_FRIENDS is defined if the compiler
doesn't support
    template<class P> friend class frd;

It seems from
https://svn.boost.org/trac/boost/ticket/1068
that these do not correspond exactly.

Are there any compilers that we still care about,
that don't support this use of friend?

Also, it sounds to me like the use of
BOOST_NO_OPERATORS_IN_NAMESPACE is
wrong because it is documented as "Compiler requires
inherited operator friend functions to be defined at namespace scope"
and there is no inheritance here. Is this right?

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk