1#ifndef HALCHECK_LIB_TREE_HPP
2#define HALCHECK_LIB_TREE_HPP
4#include <halcheck/lib/iterator.hpp>
9namespace halcheck {
namespace lib {
16 box() : ptr(new tree()) {}
17 box(box &&other)
noexcept(
false) : ptr(new tree(
std::move(*other))) {}
18 box(
const box &other) : ptr(new tree(*other)) {}
19 box &operator=(box &&other)
noexcept(
false) {
24 box &operator=(
const box &other) {
29 ~box() {
delete ptr; }
31 tree &operator*() {
return *ptr; }
32 const tree &operator*()
const {
return *ptr; }
33 tree *operator->() {
return ptr; }
34 const tree *operator->()
const {
return ptr; }
53 Map<K, box> _children;
56 tree &operator[](
const K &key) {
return *_children[key]; }
58 tree &at(
const K &key) {
return *_children.at(key); }
59 const tree &at(
const K &key)
const {
return *_children.at(key); }
62 const V *get()
const {}
64 V &operator*() {
return *get(); }
65 const V &operator*()
const {
return *get(); }
67 V *operator->() {
return get(); }
68 const V *operator->()
const {
return get(); }
70 using iterator = lib::transform_iterator<lib::iterator_t<Map<K, box>>, unbox>;
71 using const_iterator = lib::transform_iterator<lib::iterator_t<const Map<K, box>>, const_unbox>;
HALCHECK_INLINE_CONSTEXPR struct halcheck::lib::@30 make_transform_iterator
Constructs a transform_iterator.
T exchange(T &value, U &&next)
An implementation of std::exchange.
Definition utility.hpp:41