mt
 All Classes Files Functions Enumerations Groups Pages
empty.h
1 /***************************************************************************
2  * Copyright (C) 2006 by Adolfo Rodriguez *
3  * adolfo.rodriguez@upc.edu *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
22 
23 // HEADER GUARD
24 #ifndef MT_EMPTY_H
25 #define MT_EMPTY_H
26 
27 // C++ STANDARD HEADERS
28 #include <iostream>
29 
30 // BOOST LIBRARY HEADERS
31 #ifdef MT_USE_BOOST
32  #include <boost/variant/static_visitor.hpp>
33 #endif
34 
35 
37 
38 namespace mt
39 {
40 
42 
53 
54 struct Empty
55 {
56  Empty(){}
57 };
58 
59 #ifdef MT_USE_BOOST
60 class EmptyVisitor : public boost::static_visitor<bool>
61 {
62 public:
63  bool operator()(const Empty&) const {return true;}
64  template <class T>
65  bool operator()(const T&) const {return false;}
66 };
67 #endif
68 
70 
71 inline bool operator==(const Empty&, const Empty&) {return true;}
72 
73 inline bool operator<(const Empty&, const Empty&) {return false;}
74 
75 inline std::ostream& operator<<(std::ostream& os, const Empty&) {return os;}
76 
77 } // mt
78 
79 #endif // MT_EMPTY_H