LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
unique.hxx
Go to the documentation of this file.
1 
6 #ifndef MISC_UNIQUE_HXX
7 # define MISC_UNIQUE_HXX
8 
9 # include <misc/unique.hh>
10 # include <misc/contract.hh>
11 
12 namespace misc
13 {
14  // FIXME: Some code was deleted here.
15 
16  template <typename T, class C>
17  inline typename unique<T, C>::value_type&
19  {
20  if (this != &rhs)
21  obj_ = rhs.obj_;
22  return *this;
23  }
24 
25  template <typename T, class C>
26  inline bool
28  {
29  return obj_ == rhs.obj_;
30  }
31 
32  template <typename T, class C>
33  inline bool
35  {
36  return !operator==(rhs);
37  }
38 
39  template <typename T, class C>
40  inline bool
42  {
43  C cmp;
44  assertion(obj_);
45  assertion(rhs.obj_);
46  return cmp(*obj_, *rhs.obj_);
47  }
48 
49  template <typename T, class C>
50  inline std::ostream&
51  operator<<(std::ostream& ostr, const unique<T, C>& the)
52  {
53  return ostr << the.object_get();
54  }
55 
56 }
57 
58 #endif // !MISC_UNIQUE_HXX