The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
TaggedBool.h
Go to the documentation of this file.
1// Copyright (C) 2016 Andrzej Krzemienski.
2//
3// Use, modification, and distribution is subject to the Boost Software
4// License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)
5//
6// copied from https://github.com/akrzemi1/explicit/tree/master/include/ak_toolkit
7// last commit: bd572fe05a700cc6766b3d09f8916c9975ccbb45
8
9#pragma once
10
11namespace Gaudi {
12 namespace tagged_bool_ns { // artificial namespace to prevent ADL lookups in namespace Gaudi
13
14 template <typename Tag>
16 bool value;
17 template <typename /*OtherTag*/>
18 friend class tagged_bool;
19
20 public:
21 constexpr explicit tagged_bool( bool v ) : value{ v } {}
22
23 constexpr explicit tagged_bool( int ) = delete;
24 constexpr explicit tagged_bool( double ) = delete;
25 constexpr explicit tagged_bool( void* ) = delete;
26
27 template <typename OtherTag>
28 constexpr explicit tagged_bool( tagged_bool<OtherTag> b ) : value{ b.value } {}
29
30 constexpr explicit operator bool() const { return value; }
31 constexpr tagged_bool operator!() const { return tagged_bool{ !value }; }
32
33 friend constexpr bool operator==( tagged_bool l, tagged_bool r ) { return l.value == r.value; }
34 friend constexpr bool operator!=( tagged_bool l, tagged_bool r ) { return l.value != r.value; }
35 };
36 } // namespace tagged_bool_ns
37
38 using tagged_bool_ns::tagged_bool; // with this tagged_bool is in namespace xplicit but with disabled ADL
39} // namespace Gaudi
friend constexpr bool operator!=(tagged_bool l, tagged_bool r)
Definition TaggedBool.h:34
constexpr tagged_bool(void *)=delete
friend constexpr bool operator==(tagged_bool l, tagged_bool r)
Definition TaggedBool.h:33
constexpr tagged_bool(double)=delete
constexpr tagged_bool(int)=delete
constexpr tagged_bool operator!() const
Definition TaggedBool.h:31
constexpr tagged_bool(tagged_bool< OtherTag > b)
Definition TaggedBool.h:28
friend class tagged_bool
Definition TaggedBool.h:18
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1