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