1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/utility/compare_pointees.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,68 @@
1.4 +// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
1.5 +//
1.6 +// Use, modification, and distribution is subject to the Boost Software
1.7 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1.8 +// http://www.boost.org/LICENSE_1_0.txt)
1.9 +//
1.10 +// See http://www.boost.org/lib/optional for documentation.
1.11 +//
1.12 +// You are welcome to contact the author at:
1.13 +// fernando_cacciola@hotmail.com
1.14 +//
1.15 +#ifndef BOOST_UTILITY_COMPARE_POINTEES_25AGO2003_HPP
1.16 +#define BOOST_UTILITY_COMPARE_POINTEES_25AGO2003_HPP
1.17 +
1.18 +#include<functional>
1.19 +
1.20 +namespace boost {
1.21 +
1.22 +// template<class OP> bool equal_pointees(OP const& x, OP const& y);
1.23 +// template<class OP> struct equal_pointees_t;
1.24 +//
1.25 +// Being OP a model of OptionalPointee (either a pointer or an optional):
1.26 +//
1.27 +// If both x and y have valid pointees, returns the result of (*x == *y)
1.28 +// If only one has a valid pointee, returns false.
1.29 +// If none have valid pointees, returns true.
1.30 +// No-throw
1.31 +template<class OptionalPointee>
1.32 +inline
1.33 +bool equal_pointees ( OptionalPointee const& x, OptionalPointee const& y )
1.34 +{
1.35 + return (!x) != (!y) ? false : ( !x ? true : (*x) == (*y) ) ;
1.36 +}
1.37 +
1.38 +template<class OptionalPointee>
1.39 +struct equal_pointees_t : std::binary_function<OptionalPointee,OptionalPointee,bool>
1.40 +{
1.41 + bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const
1.42 + { return equal_pointees(x,y) ; }
1.43 +} ;
1.44 +
1.45 +// template<class OP> bool less_pointees(OP const& x, OP const& y);
1.46 +// template<class OP> struct less_pointees_t;
1.47 +//
1.48 +// Being OP a model of OptionalPointee (either a pointer or an optional):
1.49 +//
1.50 +// If y has not a valid pointee, returns false.
1.51 +// ElseIf x has not a valid pointee, returns true.
1.52 +// ElseIf both x and y have valid pointees, returns the result of (*x < *y)
1.53 +// No-throw
1.54 +template<class OptionalPointee>
1.55 +inline
1.56 +bool less_pointees ( OptionalPointee const& x, OptionalPointee const& y )
1.57 +{
1.58 + return !y ? false : ( !x ? true : (*x) < (*y) ) ;
1.59 +}
1.60 +
1.61 +template<class OptionalPointee>
1.62 +struct less_pointees_t : std::binary_function<OptionalPointee,OptionalPointee,bool>
1.63 +{
1.64 + bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const
1.65 + { return less_pointees(x,y) ; }
1.66 +} ;
1.67 +
1.68 +} // namespace boost
1.69 +
1.70 +#endif
1.71 +