libbio
Loading...
Searching...
No Matches
inc
bio
common
type
IsBaseOf.h
Go to the documentation of this file.
1
/*
2
* This file is a part of the Biology project by eons LLC.
3
* Biology (aka Develop Biology) is a framework for approaching software
4
* development from a natural sciences perspective.
5
*
6
* Copyright (C) 2026 Séon O'Shannon & eons LLC
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Affero General Public License as
10
* published by the Free Software Foundation, either version 3 of the
11
* License, or (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
17
*
18
* You should have received a copy of the GNU Affero General Public License
19
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20
*/
21
22
#pragma once
23
24
#if BIO_CPP_VERSION >= 11
25
26
#include <type_traits>
27
28
#endif
29
30
namespace
bio
{
31
namespace
type {
32
38
template
<
typename
BASE,
typename
DERIVED >
39
struct
IsBaseOf
40
{
41
#if BIO_CPP_VERSION >= 11
42
enum
{
Value
= ::std::is_base_of< BASE, DERIVED >::value };
43
#else
44
private
:
45
typedef
char
Yes
;
46
struct
No
47
{
48
char
value
[2];
49
};
50
51
static
Yes
Test(
BASE
*);
52
static
No Test(...);
53
static
DERIVED
* DerivedPointer();
54
55
public
:
56
enum
{
Value
=
sizeof
(Test(DerivedPointer())) ==
sizeof
(
Yes
) };
57
#endif
58
};
59
60
}
//type namespace
61
}
//bio namespace
value
double value
Definition
Potential.cpp:41
bio::Pointer
Definition
Pointer.h:115
bio
Definition
FinalCell.h:29
bio::type::IsBaseOf
Definition
IsBaseOf.h:40
bio::type::IsBaseOf::Value
@ Value
Definition
IsBaseOf.h:56
Generated by
1.9.8