LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
variant.hxx
Go to the documentation of this file.
1 
6 #ifndef MISC_VARIANT_HXX
7 # define MISC_VARIANT_HXX
8 
9 # include <boost/variant/get.hpp>
10 # include <misc/variant.hh>
11 
12 namespace misc
13 {
14 
15  template <typename T0, typename T1>
17  {
18  // NOTE TO USER :
19  // Compile error from here indicates that the first bound
20  // type is not default-constructible, and so variant cannot
21  // support its own default-construction.
22  }
23 
24  template <typename T0, typename T1>
25  template <typename U>
26  variant<T0, T1>::variant(const U& rhs) : super_type(rhs)
27  {
28  }
29 
30  template <typename T0, typename T1>
31  template <typename U>
34  {
35  // Don't assign to oneself.
36  if (static_cast<const void*>(&rhs) == static_cast<const void*>(this))
37  return *this;
38  super_type::operator=(rhs);
39  return *this;
40  }
41 
42  template <typename T0, typename T1>
44  {
45  return boost::get<T0>(*this);
46  }
47 
48  // FIXME: Some code was deleted here.
49 
50  template <typename T0, typename T1>
51  variant<T0, T1>::operator const T0&() const
52  {
53  return boost::get<T0>(*this);
54  }
55 
56  // FIXME: Some code was deleted here.
57 
58 } // namespace misc
59 
60 #endif // !MISC_VARIANT_HXX