DDC 0.1.0
Loading...
Searching...
No Matches
chunk_traits.hpp
1// Copyright (C) The DDC development team, see COPYRIGHT.md file
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <type_traits>
8#include <utility>
9
10namespace ddc {
11
12template <class T>
13inline constexpr bool enable_borrowed_chunk = false;
14
15template <class T>
16inline constexpr bool enable_chunk = false;
17
18template <class T>
20
21template <class T>
22inline constexpr bool is_borrowed_chunk_v
23 = is_chunk_v<T>
26
27template <class T>
28struct chunk_traits
29{
30 static_assert(is_chunk_v<T>);
31 using value_type
32 = std::remove_cv_t<std::remove_pointer_t<decltype(std::declval<T>().data_handle())>>;
33 using pointer_type = decltype(std::declval<T>().data_handle());
34 using reference_type = decltype(*std::declval<T>().data_handle());
35};
36
37template <class T>
38using chunk_value_t = typename chunk_traits<T>::value_type;
39
40template <class T>
41using chunk_pointer_t = typename chunk_traits<T>::pointer_type;
42
43template <class T>
44using chunk_reference_t = typename chunk_traits<T>::reference_type;
45
46template <class T>
47inline constexpr bool is_writable_chunk_v
49
50} // namespace ddc
The top-level namespace of DDC.
constexpr bool is_borrowed_chunk_v
constexpr bool enable_borrowed_chunk
constexpr bool enable_chunk
constexpr bool is_chunk_v
constexpr bool is_writable_chunk_v