diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_function_base.h --- a/epoc32/include/stdapis/stlportv5/stl/_function_base.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_function_base.h Wed Mar 31 12:33:34 2010 +0100 @@ -9,13 +9,13 @@ * Copyright (c) 1997 * Moscow Center for SPARC Technology * - * Copyright (c) 1999 + * Copyright (c) 1999 * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * - * Permission to use or copy this software for any purpose is hereby granted + * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was @@ -30,8 +30,8 @@ #ifndef _STLP_INTERNAL_FUNCTION_BASE_H #define _STLP_INTERNAL_FUNCTION_BASE_H -#ifndef _STLP_CONFIG_H -#include +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_TYPE_TRAITS_H) +# include #endif _STLP_BEGIN_NAMESPACE @@ -47,43 +47,50 @@ typedef _Arg1 first_argument_type; typedef _Arg2 second_argument_type; typedef _Result result_type; -}; +}; template -struct equal_to : public binary_function<_Tp,_Tp,bool> -{ +struct equal_to : public binary_function<_Tp, _Tp, bool> { bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } }; template -struct not_equal_to : public binary_function<_Tp,_Tp,bool> +struct less : public binary_function<_Tp,_Tp,bool> +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +/* less is the default template parameter for many STL containers, to fully use + * the move constructor feature we need to know that the default less is just a + * functor. + */ + , public __stlport_class > +#endif { - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + //This is for a very special compiler config: partial template specialization + //but no template function partial ordering. + void swap(less<_Tp>&) {} +#endif }; +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) template -struct greater : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } +struct __type_traits > { +#if !defined (__BORLANDC__) + typedef typename _IsSTLportClass >::_Ret _STLportLess; +#else + enum { _Is = _IsSTLportClass >::_Is }; + typedef typename __bool2type<_Is>::_Ret _STLportLess; +#endif + typedef _STLportLess has_trivial_default_constructor; + typedef _STLportLess has_trivial_copy_constructor; + typedef _STLportLess has_trivial_assignment_operator; + typedef _STLportLess has_trivial_destructor; + typedef _STLportLess is_POD_type; }; +#endif -template -struct less : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } -}; - -template -struct greater_equal : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } -}; - -template -struct less_equal : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } -}; +_STLP_MOVE_TO_PRIV_NAMESPACE template less<_Tp> __less(_Tp* ) { return less<_Tp>(); } @@ -91,61 +98,34 @@ template equal_to<_Tp> __equal_to(_Tp* ) { return equal_to<_Tp>(); } +_STLP_MOVE_TO_STD_NAMESPACE + template -struct plus : public binary_function<_Tp,_Tp,_Tp> { +struct plus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } }; template -struct minus : public binary_function<_Tp,_Tp,_Tp> { +struct minus : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } }; +_STLP_MOVE_TO_PRIV_NAMESPACE + template plus<_Tp> __plus(_Tp* ) { return plus<_Tp>(); } template minus<_Tp> __minus(_Tp* ) { return minus<_Tp>(); } +_STLP_MOVE_TO_STD_NAMESPACE + template -struct multiplies : public binary_function<_Tp,_Tp,_Tp> { +struct multiplies : public binary_function<_Tp, _Tp, _Tp> { _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } }; -template -struct divides : public binary_function<_Tp,_Tp,_Tp> { - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } -}; - -template -struct modulus : public binary_function<_Tp,_Tp,_Tp> -{ - _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } -}; - -template -struct negate : public unary_function<_Tp,_Tp> -{ - _Tp operator()(const _Tp& __x) const { return -__x; } -}; - -template -struct logical_and : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } -}; - -template -struct logical_or : public binary_function<_Tp,_Tp,bool> -{ - bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } -}; - -template -struct logical_not : public unary_function<_Tp,bool> -{ - bool operator()(const _Tp& __x) const { return !__x; } -}; +_STLP_MOVE_TO_PRIV_NAMESPACE template struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { @@ -155,8 +135,7 @@ }; template -struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> -{ +struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { const typename _Pair::second_type& operator()(const _Pair& __x) const { return __x.second; } @@ -173,17 +152,17 @@ _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; } }; -#ifdef _STLP_MULTI_CONST_TEMPLATE_ARG_BUG +#if defined (_STLP_MULTI_CONST_TEMPLATE_ARG_BUG) // fbp : sort of select1st just for maps -template +template // JDJ (CW Pro1 doesn't like const when first_type is also const) struct __Select1st_hint : public unary_function<_Pair, _Whatever> { const _Whatever& operator () (const _Pair& __x) const { return __x.first; } }; -# define _STLP_SELECT1ST(__x,__y) __Select1st_hint< __x, __y > -# else -# define _STLP_SELECT1ST(__x, __y) _Select1st< __x > -# endif +# define _STLP_SELECT1ST(__x,__y) _STLP_PRIV __Select1st_hint< __x, __y > +#else +# define _STLP_SELECT1ST(__x, __y) _STLP_PRIV _Select1st< __x > +#endif template struct _Identity : public unary_function<_Tp,_Tp> { @@ -217,6 +196,8 @@ template inline _Tp __identity_element(plus<_Tp>) { return _Tp(0); } template inline _Tp __identity_element(multiplies<_Tp>) { return _Tp(1); } +_STLP_MOVE_TO_STD_NAMESPACE + _STLP_END_NAMESPACE #endif /* _STLP_INTERNAL_FUNCTION_BASE_H */