COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
InvalidByDefault.h
1//
2// Copyright 2017 - 2024 (C). Alex Robenko. All rights reserved.
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8#pragma once
9
10namespace comms
11{
12
13namespace field
14{
15
16namespace adapter
17{
18
19template <typename TBase>
20class InvalidByDefault : public TBase
21{
22 using BaseImpl = TBase;
23public:
24
25 using ValueType = typename BaseImpl::ValueType;
26
27 InvalidByDefault() = default;
28
29 explicit InvalidByDefault(const ValueType& val)
30 : BaseImpl(val)
31 {
32 }
33
34 explicit InvalidByDefault(ValueType&& val)
35 : BaseImpl(std::move(val))
36 {
37 }
38
39 InvalidByDefault(const InvalidByDefault&) = default;
40 InvalidByDefault(InvalidByDefault&&) = default;
41 InvalidByDefault& operator=(const InvalidByDefault&) = default;
42 InvalidByDefault& operator=(InvalidByDefault&&) = default;
43
44 static constexpr bool valid()
45 {
46 return false;
47 }
48};
49
50} // namespace adapter
51
52} // namespace field
53
54} // namespace comms
55
comms::option::def::InvalidByDefault InvalidByDefault
Same as comms::option::def::InvalidByDefault.
Definition options.h:1815
Main namespace for all classes / functions of COMMS library.
STL namespace.