• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***********************************************************************************
2   ThrowCompare.h
3 
4     Interface for the ThrowCompare class
5 
6  * Copyright (c) 1997
7  * Mark of the Unicorn, Inc.
8  *
9  * Permission to use, copy, modify, distribute and sell this software
10  * and its documentation for any purpose is hereby granted without fee,
11  * provided that the above copyright notice appear in all copies and
12  * that both that copyright notice and this permission notice appear
13  * in supporting documentation.  Mark of the Unicorn makes no
14  * representations about the suitability of this software for any
15  * purpose.  It is provided "as is" without express or implied warranty.
16 
17 ***********************************************************************************/
18 #ifndef ThrowCompare_H_
19 #define ThrowCompare_H_
20 
21 #include "Prefix.h"
22 #include "TestClass.h"
23 
24 struct ThrowCompare {
operatorThrowCompare25   bool operator()( const TestClass& a, const TestClass& b ) const {
26     simulate_possible_failure();
27     return a < b;
28   }
29 };
30 
31 
32 struct ThrowEqual {
operatorThrowEqual33   inline bool operator()( const TestClass& a, const TestClass& b ) const {
34     simulate_possible_failure();
35     return a == b;
36   }
37 };
38 
39 struct ThrowHash { // : private ThrowCompare
operatorThrowHash40   inline EH_CSTD::size_t operator()( const TestClass& a ) const {
41     simulate_possible_failure();
42     return EH_CSTD::size_t(a.value());
43   }
44 };
45 
46 #endif // ThrowCompare_H_
47