LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
unique.hh
Go to the documentation of this file.
1 
6 #ifndef MISC_UNIQUE_HH
7 # define MISC_UNIQUE_HH
8 
9 # include <set>
10 # include <iosfwd>
11 
12 namespace misc
13 {
14 
20  template <typename T,
21  class C = std::less<T>>
22  class unique
23  {
24  protected:
26  typedef std::set<T, C> object_set_type;
28  typedef typename object_set_type::size_type object_size_type;
29 
30  public:
32  typedef T data_type;
33 
38  unique(const data_type& s);
39  virtual ~unique();
44 
45  virtual const data_type& object_get() const;
46  virtual operator const data_type&() const;
47 
56  virtual value_type& operator=(const value_type& rhs);
57 
60  virtual bool operator==(const value_type& rhs) const;
63  virtual bool operator!=(const value_type& rhs) const;
66  virtual bool operator<(const value_type& rhs) const;
69  protected:
72 
74  const data_type* obj_;
75  };
76 
81  template <typename T, class C>
82  std::ostream& operator<<(std::ostream& ostr, const unique<T, C>& u);
83 }
84 
85 # include <misc/unique.hxx>
86 
87 #endif // !MISC_UNIQUE_HH