Spicy
bool.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <string>
6 
7 #include <hilti/rt/extension-points.h>
8 
9 namespace hilti::rt {
10 
11 class Bool {
12 public:
13  constexpr Bool() = default;
14  constexpr /*implicit*/ Bool(bool value) : _value(value) {}
15 
16  constexpr /*implicit*/ operator bool() const { return _value; }
17 
18 private:
19  bool _value = false;
20 };
21 
22 namespace detail::adl {
23 inline std::string to_string(bool x, adl::tag /*unused*/) { return (x ? "True" : "False"); }
24 inline std::string to_string(Bool x, adl::tag /*unused*/) { return hilti::rt::to_string(static_cast<bool>(x)); }
25 
26 } // namespace detail::adl
27 
28 } // namespace hilti::rt
std::string to_string(T &&x)
Definition: extension-points.h:26
Definition: any.h:7
Definition: bool.h:11