?? rfunctional.h
字號:
// Copyright 2000 by Robert Dick.
// All rights reserved.
#ifndef R_FUNCTIONAL_H_
#define R_FUNCTIONAL_H_
/* Defines functional object interfaces similar to STL but with protection
against deletes through a pointer to the base class. Provides simple
functional objects. */
/*###########################################################################*/
template <class Arg, class Result>
struct runary_function {
typedef Arg argument_type;
typedef Result result_type;
protected:
~runary_function() {}
};
/*===========================================================================*/
template <typename Arg1, typename Arg2, typename Result>
struct rbinary_function {
typedef Arg1 first_argument_type;
typedef Arg2 second_argument_type;
typedef Result result_type;
protected:
~rbinary_function() {}
};
/*###########################################################################*/
template <typename T>
struct ptr_dereference : public runary_function<T *, T &>
{ T & operator()(T * x) { return *x; } };
template <typename T>
struct ptr_reference : public runary_function<T &, T *>
{ T * operator()(T &) { return &x; } };
/*===========================================================================*/
template <typename T>
struct deref_less : public rbinary_function<const T *, const T *, bool> {
bool operator()(const T * a, const T * b) { return *a < *b; }
};
/*===========================================================================*/
template <typename T>
struct deref_equal_to : public rbinary_function<const T *, const T *, bool> {
bool operator()(const T * a, const T * b) { return *a == *b; }
};
/*###########################################################################*/
#include "RFunctional.cct"
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -