Code

update 2geom
[inkscape.git] / src / 2geom / ord.h
2 #ifndef __2GEOM_ORD__
3 #define __2GEOM_ORD__
5 namespace {
7 enum Cmp {
8   LESS_THAN=-1,
9   GREATER_THAN=1,
10   EQUAL_TO=0
11 };
13 inline Cmp operator-(Cmp x) {
14   switch(x) {
15   case LESS_THAN:
16     return GREATER_THAN;
17   case GREATER_THAN:
18     return LESS_THAN;
19   case EQUAL_TO:
20     return EQUAL_TO;
21   }
22 }
24 template <typename T1, typename T2>
25 inline Cmp cmp(T1 const &a, T2 const &b) {
26   if ( a < b ) {
27     return LESS_THAN;
28   } else if ( b < a ) {
29     return GREATER_THAN;
30   } else {
31     return EQUAL_TO;
32   }
33 }
35 }
37 #endif
39 /*
40   Local Variables:
41   mode:c++
42   c-file-style:"stroustrup"
43   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
44   indent-tabs-mode:nil
45   fill-column:99
46   End:
47 */
48 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :