blob: a9fcf6897233a3e108f1c6d9a26f95056e08fea5 [file] [log] [blame]
Marshall Clow354d39c2014-01-16 16:58:45 +00001//===----------------------------------------------------------------------===//
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
Marshall Clow25d34022013-08-13 01:11:06 +000010#ifndef __PRIVATE_CONSTRUCTOR__H
11#define __PRIVATE_CONSTRUCTOR__H
12
13#include <iostream>
14
15struct PrivateConstructor {
16
17 PrivateConstructor static make ( int v ) { return PrivateConstructor(v); }
18 int get () const { return val; }
19private:
20 PrivateConstructor ( int v ) : val(v) {}
21 int val;
22 };
23
24bool operator < ( const PrivateConstructor &lhs, const PrivateConstructor &rhs ) { return lhs.get() < rhs.get(); }
25
26bool operator < ( const PrivateConstructor &lhs, int rhs ) { return lhs.get() < rhs; }
27bool operator < ( int lhs, const PrivateConstructor &rhs ) { return lhs < rhs.get(); }
28
29std::ostream & operator << ( std::ostream &os, const PrivateConstructor &foo ) { return os << foo.get (); }
30
31#endif