Electroneum
is_node_empty.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/variant/static_visitor.hpp>
4 
5 #include "mstch/mstch.hpp"
6 
7 namespace mstch {
8 
9 class is_node_empty: public boost::static_visitor<bool> {
10  public:
11  template<class T>
12  bool operator()(const T&) const {
13  return false;
14  }
15 
16  bool operator()(const std::nullptr_t&) const {
17  return true;
18  }
19 
20  bool operator()(const int& value) const {
21  return value == 0;
22  }
23 
24  bool operator()(const double& value) const {
25  return value == 0;
26  }
27 
28  bool operator()(const bool& value) const {
29  return !value;
30  }
31 
32  bool operator()(const std::string& value) const {
33  return value == "";
34  }
35 
36  bool operator()(const array& array) const {
37  return array.size() == 0;
38  }
39 };
40 
41 }
const uint32_t T[512]
Definition: groestl_tables.h:34
bool operator()(const double &value) const
Definition: is_node_empty.hpp:24
Definition: is_node_empty.hpp:9
bool operator()(const int &value) const
Definition: is_node_empty.hpp:20
std::vector< node > array
Definition: mstch.hpp:120
Definition: mstch.hpp:11
bool operator()(const array &array) const
Definition: is_node_empty.hpp:36
bool operator()(const bool &value) const
Definition: is_node_empty.hpp:28
bool operator()(const std::nullptr_t &) const
Definition: is_node_empty.hpp:16
bool operator()(const T &) const
Definition: is_node_empty.hpp:12
bool operator()(const std::string &value) const
Definition: is_node_empty.hpp:32