⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfunctional.h

📁 C语言前端编译器,yacc/lex编写,可自行修改代码.
💻 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 + -