ttg 1.0.0
Template Task Graph (TTG): flowgraph-based programming model for high-performance distributed-memory algorithms
Loading...
Searching...
No Matches
void.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2#ifndef TTG_VOID_H
3#define TTG_VOID_H
4#include <iostream>
5#include "ttg/util/meta.h"
6
7namespace ttg {
9
12 class Void {
13 public:
14 Void() = default;
15 template <typename T> explicit Void(T&&) {}
16 };
17
18 inline bool operator==(const Void&, const Void&) { return true; }
19 inline bool operator!=(const Void&, const Void&) { return false; }
20
21 inline std::ostream& operator<<(std::ostream& os, const ttg::Void&) {
22 return os;
23 }
24
25 static_assert(meta::is_empty_tuple_v<std::tuple<>>,"ouch");
26 static_assert(meta::is_empty_tuple_v<std::tuple<Void>>,"ouch");
27
28 namespace detail {
29
30 template<std::size_t... Is>
31 auto make_void_tuple(std::index_sequence<Is...>) {
32 auto g = [](int i){ return Void{}; };
33 return std::make_tuple(g(Is)...);
34 }
35
36 template<std::size_t N>
38 return make_void_tuple(std::make_index_sequence<N>{});
39 }
40
41 } // namespace detail
42
43} // namespace ttg
44
45namespace std {
46 template <>
47 struct hash<ttg::Void> {
48 template <typename ... Args> int64_t operator()(Args&& ... args) const { return 0; }
49 };
50} // namespace std
51
52#endif // TTG_VOID_H
A complete version of void.
Definition void.h:12
Void()=default
Void(T &&)
Definition void.h:15
STL namespace.
auto make_void_tuple()
Definition void.h:37
constexpr auto get(typelist< T, RestOfTs... >)
Definition typelist.h:102
top-level TTG namespace contains runtime-neutral functionality
Definition keymap.h:9
std::ostream & operator<<(std::ostream &os, const MultiIndex< Rank > &key)
Definition multiindex.h:84
bool operator==(const Void &, const Void &)
Definition void.h:18
bool operator!=(const Void &, const Void &)
Definition void.h:19
int64_t operator()(Args &&... args) const
Definition void.h:48