_ctraits_fns.h revision 9720d5f59b9c1f5d1b9ecbc9173dbcb71bd557be
19720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/* 29720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1999 39720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Silicon Graphics Computer Systems, Inc. 49720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * 59720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to use, copy, modify, distribute and sell this software 69720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * and its documentation for any purpose is hereby granted without fee, 79720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * provided that the above copyright notice appear in all copies and 89720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * that both that copyright notice and this permission notice appear 99720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * in supporting documentation. Silicon Graphics makes no 109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * representations about the suitability of this software for any 119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * purpose. It is provided "as is" without express or implied warranty. 129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */ 139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// WARNING: This is an internal header file, included by other C++ 159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// standard library headers. You should not attempt to use this header 169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// file directly. 179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H 199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H 209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_FUNCTION_BASE_H 229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block# include <stl/_function_base.h> 239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif 249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// This file contains a few small adapters that allow a character 269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// traits class to be used as a function object. 279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_BEGIN_NAMESPACE 299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_PRIV_NAMESPACE 319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Traits> 339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockstruct _Eq_traits 349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block : public binary_function<typename _Traits::char_type, 359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block typename _Traits::char_type, 369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block bool> { 379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block bool operator()(const typename _Traits::char_type& __x, 389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block const typename _Traits::char_type& __y) const 399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block { return _Traits::eq(__x, __y); } 409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block}; 419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Traits> 439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockstruct _Eq_char_bound 449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block : public unary_function<typename _Traits::char_type, bool> { 459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block typename _Traits::char_type __val; 469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block _Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {} 479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block bool operator()(const typename _Traits::char_type& __x) const 489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block { return _Traits::eq(__x, __val); } 499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block}; 509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Traits> 529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockstruct _Neq_char_bound 539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block : public unary_function<typename _Traits::char_type, bool> 549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{ 559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block typename _Traits::char_type __val; 569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block _Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {} 579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block bool operator()(const typename _Traits::char_type& __x) const 589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block { return !_Traits::eq(__x, __val); } 599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block}; 609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Traits> 629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockstruct _Eq_int_bound 639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block : public unary_function<typename _Traits::char_type, bool> { 649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block typename _Traits::int_type __val; 659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block _Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {} 679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block bool operator()(const typename _Traits::char_type& __x) const 689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block { return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); } 699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block}; 709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if 0 729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Traits> 739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockstruct _Lt_traits 749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block : public binary_function<typename _Traits::char_type, 759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block typename _Traits::char_type, 769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block bool> { 779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block bool operator()(const typename _Traits::char_type& __x, 789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block const typename _Traits::char_type& __y) const 799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block { return _Traits::lt(__x, __y); } 809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block}; 819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif 829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_STD_NAMESPACE 849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_END_NAMESPACE 869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */ 889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block 899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Local Variables: 909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// mode:C++ 919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// End: 92