Turi Create
4.0
is_sarray_like.hpp
1
/* Copyright © 2017 Apple Inc. All rights reserved.
2
*
3
* Use of this source code is governed by a BSD-3-clause license that can
4
* be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5
*/
6
#ifndef TURI_UNITY_SFRAME_IS_SARRAY_LIKE_HPP
7
#define TURI_UNITY_SFRAME_IS_SARRAY_LIKE_HPP
8
#include <memory>
9
#include <core/storage/sframe_data/is_siterable.hpp>
10
#include <core/storage/sframe_data/is_swriter_base.hpp>
11
namespace
turi
{
12
namespace
sframe_impl {
13
14
template
<
typename
T>
15
struct
has_get_reader_function {
16
template
<
typename
U, std::unique_ptr<
typename
U::reader_type> (U::*)(
size_t
) const>
struct
SFINAE {};
17
template
<
typename
U>
static
char
Test(SFINAE<U, &U::get_reader>*);
18
template
<
typename
U>
static
int
Test(...);
19
static
constexpr
bool
value =
sizeof
(Test<T>(0)) ==
sizeof
(char);
20
};
21
22
23
/**
24
* \ingroup sframe_physical
25
* is_sarray_like<T>::value is true if T inherits from swriter_base and
26
* has a get_reader() function implemented which returns an
27
* std::unique_ptr<T::reader_type>
28
*/
29
template
<
typename
T,
30
typename
DecayedT =
typename
std::decay<T>::type,
31
typename
Iterator =
typename
DecayedT::iterator>
32
struct
is_sarray_like
{
33
static
constexpr
bool
value =
is_swriter_base<T>::value
&&
34
has_get_reader_function<DecayedT>::value;
35
};
36
37
38
39
template
<
typename
T>
40
struct
is_sarray_like
<T,void,void> {
41
static
constexpr
bool
value =
false
;
42
};
43
44
45
}
// sframe_impl
46
}
// turicreate
47
#endif
turi::sframe_impl::is_swriter_base
Definition:
is_swriter_base.hpp:24
turi::sframe_impl::is_sarray_like
Definition:
is_sarray_like.hpp:32
turi
SKD.
Definition:
capi_initialization.hpp:11
core
storage
sframe_data
is_sarray_like.hpp
Generated by
1.8.13