From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- tiger-compiler/lib/misc/list.hh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tiger-compiler/lib/misc/list.hh (limited to 'tiger-compiler/lib/misc/list.hh') diff --git a/tiger-compiler/lib/misc/list.hh b/tiger-compiler/lib/misc/list.hh new file mode 100644 index 0000000..d27ab66 --- /dev/null +++ b/tiger-compiler/lib/misc/list.hh @@ -0,0 +1,25 @@ +/** + ** \file misc/list.hh + ** \brief Declaration of misc::list + */ + +#pragma once + +#include + +/// Wrappers on misc::vectors to provide functional-style list manipulation. +namespace misc::list +{ + /// Build a list of a \a head and a \a tail. + template vector cons(const T head, const vector& tail); + + /// Get the head and tail of the list. Invert of cons. + template std::pair> snoc(const vector& v); + + /// Decompose the list into an array to use structured bindings. + template + std::array decompose(const vector& v); + +} // namespace misc::list + +#include -- cgit v1.2.3