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 17 PrivateConstructor static make ( int v ) { return PrivateConstructor(v); } 18 int get () const { return val; } 19 private: 20 PrivateConstructor ( int v ) : val(v) {} 21 int val; 22 }; 23 24 bool operator < ( const PrivateConstructor &lhs, const PrivateConstructor &rhs ) { return lhs.get() < rhs.get(); } 25 26 bool operator < ( const PrivateConstructor &lhs, int rhs ) { return lhs.get() < rhs; } 27 bool operator < ( int lhs, const PrivateConstructor &rhs ) { return lhs < rhs.get(); } 28 29 std::ostream & operator << ( std::ostream &os, const PrivateConstructor &foo ) { return os << foo.get (); } 30 31 #endif 32