cppcomp.h
来自「稀疏矩阵、链表、图、队列、二叉树、多叉树、排序、遗传算法等的实现」· C头文件 代码 · 共 78 行
H
78 行
/*
** The proper usage and copyright information for
** this software is covered in DSCRLic.TXT
** This code is Copyright 1999 by Dann Corbit
*/
/*
** Etype comparison functions for C++ templates.
*/
#define PRELUDE template < class Etype > inline
/*
** Is object a strictly greater than object b?
*/
PRELUDE
int GT(Etype & a, Etype & b)
{
return a > b;
}
/*
** Is object a greater than or equal to object b?
*/
PRELUDE
int GE(Etype & a, Etype & b)
{
return a >= b;
}
/*
** Is object a strictly less than object b?
*/
PRELUDE
int LT(Etype & a, Etype & b)
{
return a < b;
}
/*
** Is object a less than or equal to object b?
*/
PRELUDE
int LE(Etype & a, Etype & b)
{
return a <= b;
}
/*
** Is object a exactly equal to object b?
*/
PRELUDE
int EQ(Etype & a, Etype & b)
{
return a == b;
}
/*
** A generic compare. The others are better.
** This requres an average of 1.5 compare operations per call.
*/
PRELUDE
int CMP(Etype & a, Etype & b)
{
return a > b ? 1 : a < b ? -1 : 0;
}
/*
** Exchange two objects in an array.
*/
PRELUDE
void SWAP(Etype & a, Etype & b)
{
Etype tmp = a;
a = b;
b = tmp;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?