The Gaudi Framework
v41r0 (bdbe7744)
Toggle main menu visibility
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
11
namespace
Gaudi
{
12
namespace
tagged_bool_ns
{
// artificial namespace to prevent ADL lookups in namespace Gaudi
13
14
template
<
typename
Tag>
15
class
tagged_bool
{
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
Gaudi::tagged_bool_ns::tagged_bool::operator!=
friend constexpr bool operator!=(tagged_bool l, tagged_bool r)
Definition
TaggedBool.h:34
Gaudi::tagged_bool_ns::tagged_bool::tagged_bool
constexpr tagged_bool(void *)=delete
Gaudi::tagged_bool_ns::tagged_bool::operator==
friend constexpr bool operator==(tagged_bool l, tagged_bool r)
Definition
TaggedBool.h:33
Gaudi::tagged_bool_ns::tagged_bool::tagged_bool
constexpr tagged_bool(double)=delete
Gaudi::tagged_bool_ns::tagged_bool::value
bool value
Definition
TaggedBool.h:16
Gaudi::tagged_bool_ns::tagged_bool::tagged_bool
constexpr tagged_bool(bool v)
Definition
TaggedBool.h:21
Gaudi::tagged_bool_ns::tagged_bool::tagged_bool
friend class tagged_bool
Definition
TaggedBool.h:18
Gaudi::tagged_bool_ns::tagged_bool::tagged_bool
constexpr tagged_bool(int)=delete
Gaudi::tagged_bool_ns::tagged_bool::operator!
constexpr tagged_bool operator!() const
Definition
TaggedBool.h:31
Gaudi::tagged_bool_ns::tagged_bool::tagged_bool
constexpr tagged_bool(tagged_bool< OtherTag > b)
Definition
TaggedBool.h:28
Gaudi::tagged_bool::tagged_bool
friend class tagged_bool
Definition
TaggedBool.h:18
Gaudi::tagged_bool_ns
Definition
TaggedBool.h:12
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
GaudiKernel
include
GaudiKernel
TaggedBool.h
Generated on
for The Gaudi Framework by
1.17.0