]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/base/TypeTraits.h
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_BASE_TYPETRAITS_H
10 #define SQUID_SRC_BASE_TYPETRAITS_H
12 namespace TypeTraits_
{ // a hack to prevent "unintended ADL"
14 // TODO: Extract reusable paradigms into other mixins (e.g., NonCopyable).
15 /// convenience base for any class with pure virtual method(s)
19 // ensures proper destruction via pointers to base interface classes
20 virtual ~Interface() = default;
22 // prohibits copy/move assignment to prevent accidental object slicing
23 Interface
&operator=(const Interface
&) = delete;
24 Interface
&operator=(Interface
&&) = delete;
26 protected: // prevents accidental creation of Interface instances
28 // allows default-construction in kids
29 constexpr Interface() = default;
31 // allows copy/move construction for kids convenience
32 Interface(const Interface
&) = default;
33 Interface(Interface
&&) = default;
36 } // namespace TypeTraits_
38 using Interface
= TypeTraits_::Interface
;
40 #endif /* SQUID_SRC_BASE_TYPETRAITS_H */