_ctraits_fns.h

00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Permission to use, copy, modify, distribute and sell this software
00006  * and its documentation for any purpose is hereby granted without fee,
00007  * provided that the above copyright notice appear in all copies and
00008  * that both that copyright notice and this permission notice appear
00009  * in supporting documentation.  Silicon Graphics makes no
00010  * representations about the suitability of this software for any
00011  * purpose.  It is provided "as is" without express or implied warranty.
00012  */ 
00013 
00014 // WARNING: This is an internal header file, included by other C++
00015 // standard library headers.  You should not attempt to use this header
00016 // file directly.
00017 
00018 #ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
00019 #define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
00020 
00021 # ifndef _STLP_INTERNAL_FUNCTION_H 
00022 #  include <stl/_function_base.h>
00023 # endif
00024 
00025 // This file contains a few small adapters that allow a character
00026 // traits class to be used as a function object.
00027 
00028 _STLP_BEGIN_NAMESPACE
00029 
00030 template <class _Traits>
00031 struct _Eq_traits
00032   : public binary_function<typename _Traits::char_type,
00033                            typename _Traits::char_type,
00034                            bool>
00035 {
00036   bool operator()(const typename _Traits::char_type& __x,
00037                   const typename _Traits::char_type& __y) const
00038     { return _Traits::eq(__x, __y); }
00039 };
00040 
00041 template <class _Traits>
00042 struct _Eq_char_bound
00043   : public unary_function<typename _Traits::char_type, bool>
00044 {
00045   typename _Traits::char_type __val;
00046   _Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
00047   bool operator()(const typename _Traits::char_type& __x) const
00048     { return _Traits::eq(__x, __val); }
00049 };
00050 
00051 template <class _Traits>
00052 struct _Neq_char_bound
00053   : public unary_function<typename _Traits::char_type, bool>
00054 {
00055   typename _Traits::char_type __val;
00056   _Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
00057   bool operator()(const typename _Traits::char_type& __x) const
00058     { return !_Traits::eq(__x, __val); }
00059 };
00060 
00061 template <class _Traits>
00062 struct _Eq_int_bound
00063   : public unary_function<typename _Traits::char_type, bool>
00064 {
00065   typename _Traits::int_type __val;
00066 
00067   _Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {}
00068   bool operator()(const typename _Traits::char_type& __x) const
00069     { return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); }
00070 };
00071 
00072 # if 0
00073 template <class _Traits>
00074 struct _Lt_traits
00075   : public binary_function<typename _Traits::char_type,
00076                            typename _Traits::char_type,
00077                            bool>
00078 {
00079   bool operator()(const typename _Traits::char_type& __x,
00080                   const typename _Traits::char_type& __y) const
00081     { return _Traits::lt(__x, __y); }
00082 };
00083 # endif
00084 
00085 _STLP_END_NAMESPACE
00086 
00087 #endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */
00088 
00089 // Local Variables:
00090 // mode:C++
00091 // End:
00092 
00093 
00094 
00095 

Generated on Mon Jun 5 10:20:45 2006 for Intelligence.kdevelop by  doxygen 1.4.6