TypeTraits.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
12namespace TypeTraits_ { // a hack to prevent "unintended ADL"
13
14// TODO: Extract reusable paradigms into other mixins (e.g., NonCopyable).
17{
18public:
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;
25
26protected: // 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
TypeTraits_::Interface Interface
Definition: TypeTraits.h:38
convenience base for any class with pure virtual method(s)
Definition: TypeTraits.h:17
Interface(const Interface &)=default
virtual ~Interface()=default
Interface & operator=(Interface &&)=delete
constexpr Interface()=default
Interface(Interface &&)=default
Interface & operator=(const Interface &)=delete

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors