xref: /llvm-project/libcxx/test/support/private_constructor.h (revision aac2de1b1af07448483f8cdb3a588b9504def9ac)
1cc89063bSNico Weber //===----------------------------------------------------------------------===//
2cc89063bSNico Weber //
3cc89063bSNico Weber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4cc89063bSNico Weber // See https://llvm.org/LICENSE.txt for license information.
5cc89063bSNico Weber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6cc89063bSNico Weber //
7cc89063bSNico Weber //===----------------------------------------------------------------------===//
8cc89063bSNico Weber 
9*aac2de1bSLouis Dionne #ifndef TEST_SUPPORT_PRIVATE_CONSTRUCTOR_H
10*aac2de1bSLouis Dionne #define TEST_SUPPORT_PRIVATE_CONSTRUCTOR_H
11cc89063bSNico Weber 
12cc89063bSNico Weber struct PrivateConstructor {
13cc89063bSNico Weber 
makePrivateConstructor14cc89063bSNico Weber     PrivateConstructor static make ( int v ) { return PrivateConstructor(v); }
getPrivateConstructor15cc89063bSNico Weber     int get () const { return val; }
16cc89063bSNico Weber private:
PrivateConstructorPrivateConstructor17cc89063bSNico Weber     PrivateConstructor ( int v ) : val(v) {}
18cc89063bSNico Weber     int val;
19cc89063bSNico Weber     };
20cc89063bSNico Weber 
21cc89063bSNico Weber bool operator < ( const PrivateConstructor &lhs, const PrivateConstructor &rhs ) { return lhs.get() < rhs.get(); }
22cc89063bSNico Weber 
23cc89063bSNico Weber bool operator < ( const PrivateConstructor &lhs, int rhs ) { return lhs.get() < rhs; }
24cc89063bSNico Weber bool operator < ( int lhs, const PrivateConstructor &rhs ) { return lhs < rhs.get(); }
25cc89063bSNico Weber 
26*aac2de1bSLouis Dionne #endif // TEST_SUPPORT_PRIVATE_CONSTRUCTOR_H
27