Lumiera  0.pre.03
»edit your freedom«
maybe-compare.hpp
Go to the documentation of this file.
1 /*
2  MAYBE-COMPARE.hpp - guarded invocation of comparisons
3 
4  Copyright (C)
5  2009, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
20 #ifndef LIB_META_MAYBE_COMPARE_H
21 #define LIB_META_MAYBE_COMPARE_H
22 
23 
24 
25 
26 namespace lib {
27 namespace meta{
28 
29 
34  template<typename X>
35  struct Comparator
36  {
37  static bool
38  equals (X const& x1, X const& x2)
39  {
40  return x1 == x2;
41  }
42  };
43 
44  /* == add specialisations here == */
45 
46 
47  template<typename X>
48  inline bool
49  equals_safeInvoke (X const& x1, X const& x2)
50  {
51  return Comparator<X>::equals(x1,x2);
52  }
53 
54 
55 }} // namespace lib::meta
56 #endif
Implementation namespace for support and library code.
Trait template for invoking equality comparison.