stlutil.hpp

来自「模糊聚類分析源碼。包含教學文件」· HPP 代码 · 共 141 行

HPP
141
字号
/*    Context       : Basic Utility Files  Author        : Frank Hoeppner, see also AUTHORS file   Description   : header of function module stlutil                  Source Documentation Handbook: tutorial-UTIL  History       : see source file  Comment       :     This file was generated automatically. DO NOT EDIT.  Copyright     : Copyright (C) 1999-2000 Frank Hoeppner    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#ifndef stlutil_HEADER#define stlutil_HEADER/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif/* necessary includes */#include <string.h> // strcmp#include <functional> // binary_function#include "define.hpp"//#define INLINE inline/* global types and constants *//* data interface *//* STLUtil interface */struct string_less  : public binary_function<char_cc,char_cc,bool>  {  bool operator() (char_cc,char_cc) const;  };template <class POINTER>struct less_dereference   : public binary_function<const POINTER, const POINTER, bool>  {  bool operator() (const POINTER ap_x, const POINTER ap_y) const    { return (*ap_x) < (*ap_y); }  };template <class POINTER>struct less_cost_dereference   : public binary_function<const POINTER, const POINTER, bool>  {  bool operator() ( const POINTER ap_x, const POINTER ap_y ) const    { return ap_x->get_cost() < ap_y->get_cost(); }  };template <class POINTER>struct less_name_dereference   : public binary_function<const POINTER, const POINTER, bool>  {  bool operator() ( const POINTER ap_x, const POINTER ap_y ) const    { return strcmp(ap_x->get_name(),ap_y->get_name())<0; }  };template <class POINTER>struct less_number_dereference   : public binary_function<const POINTER, const POINTER, bool>  {  bool operator() ( const POINTER ap_x, const POINTER ap_y ) const    { return ap_x->get_number() < ap_y->get_number(); }  };/* inline implementation */template <class Operation1, class Operation2, class Operation3>class mixed_compose   : public binary_function      <      typename Operation2::argument_type,      typename Operation3::argument_type,      typename Operation1::result_type      >  {  public:    mixed_compose(const Operation1& x, const Operation2& y, const Operation3& z)       : op1(x), op2(y), op3(z) {}    result_type operator() (const first_argument_type& x, const second_argument_type& y) const      { return op1( op2(x), op3(y) ); }  protected:    Operation1 op1;    Operation2 op2;    Operation3 op3;  };template <class Operation1, class Operation2>unary_compose<Operation1,Operation2> compose(const Operation1& op1,const Operation2& op2)  { return unary_compose<Operation1,Operation2>(op1,op2); }template <class Operation1, class Operation2, class Operation3>mixed_compose<Operation1,Operation2,Operation3> compose(const Operation1& op1,const Operation2& op2,const Operation3& op3)  { return mixed_compose<Operation1,Operation2,Operation3>(op1,op2,op3); }template <class T> struct Deleter  {   inline void operator() (T* p) { delete p; }   };#endif /* stlutil_HEADER */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?