Skip to content

Commit d59092a

Browse files
author
Eduardo Madrid
committed
Eliminates dependency on metatools for AnyContainer
1 parent 732e02a commit d59092a

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

inc/meta/InplaceType.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
3+
#ifndef NO_STANDARD_INCLUDES
4+
#include <type_traits>
5+
#include <utility>
6+
#endif
7+
8+
namespace meta {
9+
template<typename T>
10+
struct InplaceType: std::false_type {};
11+
12+
template<typename T>
13+
struct InplaceType<std::in_place_type_t<T>>: std::true_type {};
14+
}

inc/meta/NotBasedOn.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#ifndef NO_STANDARD_INCLUDES
4+
#include <type_traits>
5+
#endif
6+
7+
namespace meta {
8+
9+
/// \brief whether \c T derives from \c Base
10+
/// \author Andrzej Krzemieński
11+
/// \note https://akrzemi1.wordpress.com/2013/10/10/too-perfect-forwarding/
12+
template<typename T, typename Base>
13+
constexpr bool NotBasedOn() {
14+
using DecayedT = std::decay_t<T>;
15+
return
16+
!std::is_same<DecayedT, Base>::value &&
17+
!std::is_base_of<Base, DecayedT>::value;
18+
}
19+
20+
}

inc/zoo/any.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#pragma once
1+
#ifndef ZOO_ANY
2+
#define ZOO_ANY
23

34
#include <zoo/PolymorphicContainer.h>
45
#include <zoo/utility.h>
@@ -296,4 +297,5 @@ typename Policy::Visit *visits(const AnyContainer<Policy> &a) {
296297

297298
}
298299

299-
/// \todo guarantee alignment new, tests
300+
#endif
301+

0 commit comments

Comments
 (0)