Macaulay2 Engine
Loading...
Searching...
No Matches
pcomparator.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright (C) 2006-2011 by Mikhail V. Zinin *
3 * mzinin@gmail.com *
4 * *
5 * You may redistribute this file under the terms of the GNU General *
6 * Public License as published by the Free Software Foundation, either *
7 * version 2 of the License, or any later version. *
8 *****************************************************************************/
9
10#ifndef BIBASIS_PCOMPARATOR_HPP
11#define BIBASIS_PCOMPARATOR_HPP
12
38
39#include <string>
40#include "error.h"
41
42namespace BIBasis
43{
44 template<class T> class PointerLessComparator
45 {
46 public:
47 bool operator() (const T* const& p1, const T* const& p2)
48 {
49 if (!p1 || !p2)
50 {
51 throw std::string("BIBasis::PointerLessComparator::operator(): at least one argument is NULL.");
52 }
53 return *p1 < *p2;
54 }
55 };
56
57 template<class T> class PointerMoreComparator
58 {
59 public:
60 bool operator() (const T* const& p1, const T* const& p2)
61 {
62 if (!p1 || !p2)
63 {
64 throw std::string("BIBasis::PointerMoreComparator::operator(): at least one argument is NULL.");
65 }
66 return *p1 > *p2;
67 }
68 };
69}
70
71#endif //BIBASIS_PCONPARATOR_HPP
bool operator()(const T *const &p1, const T *const &p2)
bool operator()(const T *const &p1, const T *const &p2)
Engine error-reporting primitives: ERROR, INTERNAL_ERROR, error, error_message.
int p1
#define T
Definition table.c:13