5#ifndef DATA_STRUCTURES_NODE_HPP_
6#define DATA_STRUCTURES_NODE_HPP_
15template <
class ValueType>
17 using value_type = ValueType;
19 std::shared_ptr<Node<ValueType>> next = {};
22template <
typename Node,
typename Action>
23void traverse(
const Node*
const inNode,
const Action& action) {
26 traverse(inNode->next.get(), action);
30template <
typename Node>
31void display_all(
const Node*
const inNode) {
33 [](
const Node& curNode) { std::cout << curNode.data <<
" "; });
36template <
typename Node>
37std::vector<typename Node::value_type> push_all_to_vector(
38 const Node*
const inNode,
const std::size_t expected_size = 0) {
39 std::vector<typename Node::value_type> res;
40 res.reserve(expected_size);
42 [&res](
const Node& curNode) { res.push_back(curNode.data); });