Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:09

0001 /* boost random/detail/operators.hpp header file
0002  *
0003  * Copyright Steven Watanabe 2010-2011
0004  * Distributed under the Boost Software License, Version 1.0. (See
0005  * accompanying file LICENSE_1_0.txt or copy at
0006  * http://www.boost.org/LICENSE_1_0.txt)
0007  *
0008  * See http://www.boost.org for most recent version including documentation.
0009  *
0010  * $Id$
0011  */
0012 
0013 #ifndef BOOST_RANDOM_DETAIL_OPERATORS_HPP
0014 #define BOOST_RANDOM_DETAIL_OPERATORS_HPP
0015 
0016 #include <boost/random/detail/config.hpp>
0017 #include <boost/detail/workaround.hpp>
0018 
0019 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1310)   \
0020     || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
0021 
0022 #define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t)                  \
0023     template<class CharT, class Traits>                                 \
0024     friend std::basic_ostream<CharT,Traits>&                            \
0025     operator<<(std::basic_ostream<CharT,Traits>& os, const T& t) {      \
0026         t.print(os, t);                                                 \
0027         return os;                                                      \
0028     }                                                                   \
0029     template<class CharT, class Traits>                                 \
0030     static std::basic_ostream<CharT,Traits>&                            \
0031     print(std::basic_ostream<CharT,Traits>& os, const T& t)
0032 
0033 #define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t)                  \
0034     template<class CharT, class Traits>                                 \
0035     friend std::basic_istream<CharT,Traits>&                            \
0036     operator>>(std::basic_istream<CharT,Traits>& is, T& t) {            \
0037         t.read(is, t);                                                  \
0038         return is;                                                      \
0039     }                                                                   \
0040     template<class CharT, class Traits>                                 \
0041     static std::basic_istream<CharT,Traits>&                            \
0042     read(std::basic_istream<CharT,Traits>& is, T& t)
0043 
0044 #endif
0045 
0046 #if defined(BOOST_BORLANDC)
0047 
0048 #define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs)              \
0049     bool operator==(const T& rhs) const                                 \
0050     { return T::is_equal(*this, rhs); }                                 \
0051     static bool is_equal(const T& lhs, const T& rhs)
0052 
0053 #define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T)                      \
0054     bool operator!=(const T& rhs) const                                 \
0055     { return !T::is_equal(*this, rhs); }
0056 
0057 #endif
0058 
0059 #ifndef BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR
0060 #define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t)                  \
0061     template<class CharT, class Traits>                                 \
0062     friend std::basic_ostream<CharT,Traits>&                            \
0063     operator<<(std::basic_ostream<CharT,Traits>& os, const T& t)
0064 #endif
0065 
0066 #ifndef BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR
0067 #define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t)                  \
0068     template<class CharT, class Traits>                                 \
0069     friend std::basic_istream<CharT,Traits>&                            \
0070     operator>>(std::basic_istream<CharT,Traits>& is, T& t)
0071 #endif
0072 
0073 #ifndef BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR
0074 #define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs)              \
0075     friend bool operator==(const T& lhs, const T& rhs)
0076 #endif
0077 
0078 #ifndef BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR
0079 #define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T)                      \
0080     friend bool operator!=(const T& lhs, const T& rhs)                  \
0081     { return !(lhs == rhs); }
0082 #endif
0083 
0084 #endif