TypeTraits.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
3  *
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.
7  */
8 
9 #ifndef SQUID_SRC_BASE_TYPETRAITS_H
10 #define SQUID_SRC_BASE_TYPETRAITS_H
11 
12 namespace TypeTraits_ { // a hack to prevent "unintended ADL"
13 
14 // TODO: Extract reusable paradigms into other mixins (e.g., NonCopyable).
16 class Interface
17 {
18 public:
19  // ensures proper destruction via pointers to base interface classes
20  virtual ~Interface() = default;
21 
22  // prohibits copy/move assignment to prevent accidental object slicing
23  Interface &operator=(const Interface &) = delete;
24  Interface &operator=(Interface &&) = delete;
25 
26 protected: // prevents accidental creation of Interface instances
27 
28  // allows default-construction in kids
29  constexpr Interface() = default;
30 
31  // allows copy/move construction for kids convenience
32  Interface(const Interface &) = default;
33  Interface(Interface &&) = default;
34 };
35 
36 } // namespace TypeTraits_
37 
39 
40 #endif /* SQUID_SRC_BASE_TYPETRAITS_H */
41 
Interface(Interface &&)=default
Interface & operator=(const Interface &)=delete
virtual ~Interface()=default
Interface & operator=(Interface &&)=delete
convenience base for any class with pure virtual method(s)
Definition: TypeTraits.h:17
constexpr Interface()=default
TypeTraits_::Interface Interface
Definition: TypeTraits.h:38
Interface(const Interface &)=default

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors