• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef __PRIVATE_CONSTRUCTOR__H
11 #define __PRIVATE_CONSTRUCTOR__H
12 
13 #include <iostream>
14 
15 struct PrivateConstructor {
16 
makePrivateConstructor17     PrivateConstructor static make ( int v ) { return PrivateConstructor(v); }
getPrivateConstructor18     int get () const { return val; }
19 private:
PrivateConstructorPrivateConstructor20     PrivateConstructor ( int v ) : val(v) {}
21     int val;
22     };
23 
operator <(const PrivateConstructor & lhs,const PrivateConstructor & rhs)24 bool operator < ( const PrivateConstructor &lhs, const PrivateConstructor &rhs ) { return lhs.get() < rhs.get(); }
25 
operator <(const PrivateConstructor & lhs,int rhs)26 bool operator < ( const PrivateConstructor &lhs, int rhs ) { return lhs.get() < rhs; }
operator <(int lhs,const PrivateConstructor & rhs)27 bool operator < ( int lhs, const PrivateConstructor &rhs ) { return lhs < rhs.get(); }
28 
operator <<(std::ostream & os,const PrivateConstructor & foo)29 std::ostream & operator << ( std::ostream &os, const PrivateConstructor &foo ) { return os << foo.get (); }
30 
31 #endif
32