137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh/* 237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * Copyright (c) 1999 337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * Silicon Graphics Computer Systems, Inc. 437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * 537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * Permission to use, copy, modify, distribute and sell this software 637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * and its documentation for any purpose is hereby granted without fee, 737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * provided that the above copyright notice appear in all copies and 837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * that both that copyright notice and this permission notice appear 937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * in supporting documentation. Silicon Graphics makes no 1037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * representations about the suitability of this software for any 1137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh * purpose. It is provided "as is" without express or implied warranty. 1237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh */ 1337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 1437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// WARNING: This is an internal header file, included by other C++ 1537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// standard library headers. You should not attempt to use this header 1637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// file directly. 1737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 1837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H 1937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh#define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H 2037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 2137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh#ifndef _STLP_INTERNAL_FUNCTION_BASE_H 2237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh# include <stl/_function_base.h> 2337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh#endif 2437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 2537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// This file contains a few small adapters that allow a character 2637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// traits class to be used as a function object. 2737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 2837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh_STLP_BEGIN_NAMESPACE 2937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 3037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh_STLP_MOVE_TO_PRIV_NAMESPACE 3137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 3237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehtemplate <class _Traits> 3337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehstruct _Eq_traits 3437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh : public binary_function<typename _Traits::char_type, 3537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh typename _Traits::char_type, 3637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh bool> { 3737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh bool operator()(const typename _Traits::char_type& __x, 3837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh const typename _Traits::char_type& __y) const 3937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh { return _Traits::eq(__x, __y); } 4037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh}; 4137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 4237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehtemplate <class _Traits> 4337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehstruct _Eq_char_bound 4437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh : public unary_function<typename _Traits::char_type, bool> { 4537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh typename _Traits::char_type __val; 4637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh _Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {} 4737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh bool operator()(const typename _Traits::char_type& __x) const 4837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh { return _Traits::eq(__x, __val); } 4937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh}; 5037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 5137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehtemplate <class _Traits> 5237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehstruct _Neq_char_bound 5337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh : public unary_function<typename _Traits::char_type, bool> 5437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh{ 5537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh typename _Traits::char_type __val; 5637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh _Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {} 5737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh bool operator()(const typename _Traits::char_type& __x) const 5837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh { return !_Traits::eq(__x, __val); } 5937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh}; 6037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 6137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehtemplate <class _Traits> 6237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehstruct _Eq_int_bound 6337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh : public unary_function<typename _Traits::char_type, bool> { 6437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh typename _Traits::int_type __val; 6537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 6637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh _Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {} 6737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh bool operator()(const typename _Traits::char_type& __x) const 6837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh { return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); } 6937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh}; 7037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 7137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh#if 0 7237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehtemplate <class _Traits> 7337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsiehstruct _Lt_traits 7437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh : public binary_function<typename _Traits::char_type, 7537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh typename _Traits::char_type, 7637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh bool> { 7737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh bool operator()(const typename _Traits::char_type& __x, 7837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh const typename _Traits::char_type& __y) const 7937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh { return _Traits::lt(__x, __y); } 8037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh}; 8137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh#endif 8237f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 8337f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh_STLP_MOVE_TO_STD_NAMESPACE 8437f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 8537f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh_STLP_END_NAMESPACE 8637f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 8737f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh#endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */ 8837f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh 8937f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// Local Variables: 9037f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// mode:C++ 9137f12739251d2637c9405c75951962b5e27bbceeAndrew Hsieh// End: 92