Chris@16: /* boost random/detail/operators.hpp header file Chris@16: * Chris@16: * Copyright Steven Watanabe 2010-2011 Chris@16: * Distributed under the Boost Software License, Version 1.0. (See Chris@16: * accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: * See http://www.boost.org for most recent version including documentation. Chris@16: * Chris@101: * $Id$ Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_RANDOM_DETAIL_OPERATORS_HPP Chris@16: #define BOOST_RANDOM_DETAIL_OPERATORS_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) \ Chris@16: || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) Chris@16: Chris@16: #define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \ Chris@16: template \ Chris@16: friend std::basic_ostream& \ Chris@16: operator<<(std::basic_ostream& os, const T& t) { \ Chris@16: t.print(os, t); \ Chris@16: return os; \ Chris@16: } \ Chris@16: template \ Chris@16: static std::basic_ostream& \ Chris@16: print(std::basic_ostream& os, const T& t) Chris@16: Chris@16: #define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t) \ Chris@16: template \ Chris@16: friend std::basic_istream& \ Chris@16: operator>>(std::basic_istream& is, T& t) { \ Chris@16: t.read(is, t); \ Chris@16: return is; \ Chris@16: } \ Chris@16: template \ Chris@16: static std::basic_istream& \ Chris@16: read(std::basic_istream& is, T& t) Chris@16: Chris@16: #endif Chris@16: Chris@16: #if defined(__BORLANDC__) Chris@16: Chris@16: #define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs) \ Chris@16: bool operator==(const T& rhs) const \ Chris@16: { return T::is_equal(*this, rhs); } \ Chris@16: static bool is_equal(const T& lhs, const T& rhs) Chris@16: Chris@16: #define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T) \ Chris@16: bool operator!=(const T& rhs) const \ Chris@16: { return !T::is_equal(*this, rhs); } Chris@16: Chris@16: #endif Chris@16: Chris@16: #ifndef BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR Chris@16: #define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \ Chris@16: template \ Chris@16: friend std::basic_ostream& \ Chris@16: operator<<(std::basic_ostream& os, const T& t) Chris@16: #endif Chris@16: Chris@16: #ifndef BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR Chris@16: #define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t) \ Chris@16: template \ Chris@16: friend std::basic_istream& \ Chris@16: operator>>(std::basic_istream& is, T& t) Chris@16: #endif Chris@16: Chris@16: #ifndef BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR Chris@16: #define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs) \ Chris@16: friend bool operator==(const T& lhs, const T& rhs) Chris@16: #endif Chris@16: Chris@16: #ifndef BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR Chris@16: #define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T) \ Chris@16: friend bool operator!=(const T& lhs, const T& rhs) \ Chris@16: { return !(lhs == rhs); } Chris@16: #endif Chris@16: Chris@16: #endif