LIPH's C++ Codes
noncopyable.h
Go to the documentation of this file.
1#ifndef LIPH_LANG_NONCOPYABLE_H_
2#define LIPH_LANG_NONCOPYABLE_H_
3
4// from boost::noncopyable
5// https://www.boost.org/users/license.html
6
7namespace liph {
8
9// Private copy constructor and copy assignment ensure classes derived from
10// class noncopyable cannot be copied.
11
12namespace noncopyable_ { // protection from unintended ADL
13
14#ifndef BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
15#define BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
16
17// noncopyable derives from base_token to enable Type Traits to detect
18// whether a type derives from noncopyable without needing the definition
19// of noncopyable itself.
20//
21// The definition of base_token is macro-guarded so that Type Traits can
22// define it locally without including this header, to avoid a dependency
23// on Core.
24
25struct base_token {};
26
27#endif // #ifndef BOOST_NONCOPYABLE_BASE_TOKEN_DEFINED
28
29// class noncopyable : base_token {
31protected:
32 constexpr noncopyable() = default;
33 ~noncopyable() = default;
34
35 noncopyable(const noncopyable&) = delete;
37};
38
39} // namespace noncopyable_
40
42
43} // namespace liph
44
45#endif // LIPH_LANG_NONCOPYABLE_H_
Definition: noncopyable.h:30
noncopyable & operator=(const noncopyable &)=delete
noncopyable(const noncopyable &)=delete
constexpr noncopyable()=default
Definition: algorithm.h:10
noncopyable_::noncopyable noncopyable
Definition: noncopyable.h:41
Definition: noncopyable.h:25