Control Surface
pin-t-adl
MIDI Control Surface library for Arduino
src
Def
TypeTraits.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <Settings/NamespaceSettings.hpp>
4
5
#include <AH/STL/type_traits>
6
#include <AH/STL/utility>
7
8
BEGIN_CS_NAMESPACE
9
10
template
<
class
...>
11
using
void_t
= void;
12
13
template
<
class
,
class
=
void
>
14
struct
has_method_begin
: std::false_type {};
15
16
template
<
class
T>
17
struct
has_method_begin<T, void_t<decltype(std::declval<T>
().begin())>>
18
: std::true_type {};
19
21
template
<
class
T>
22
typename
std::enable_if<has_method_begin<T>::value>::type
23
begin_if_possible
(T &t) {
24
t.begin();
25
}
26
27
template
<
class
T>
28
typename
std::enable_if<!has_method_begin<T>::value>::type
29
begin_if_possible
(T &) {}
30
31
END_CS_NAMESPACE
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition:
Settings/NamespaceSettings.hpp:10
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition:
Settings/NamespaceSettings.hpp:9
begin_if_possible
std::enable_if< has_method_begin< T >::value >::type begin_if_possible(T &t)
Calls the begin() method of t if that method exists.
Definition:
TypeTraits.hpp:23
void_t
void void_t
Definition:
TypeTraits.hpp:11
has_method_begin
Definition:
TypeTraits.hpp:14
Generated by
1.9.4