Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Sequence_SparseSortedMapping.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Containers_Concrete_Sequence_SparseSortedMapping_h_
5#define _Stroika_Foundation_Containers_Concrete_Sequence_SparseSortedMapping_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include "Stroika/Foundation/Containers/Sequence.h"
10
11/**
12 * \file
13 *
14 * \version NOT IMPLEMENTED
15 *
16 * TODO:
17 * @todo Most of the implementation is simple - use SortedMapping_stdmap as a backend. Map from idx
18 * to value. On any update, remove values if they are the special 'sparse' value. On iteration,
19 * count the gap between index values and return the 'sparse' value.
20 *
21 * Lookup by index is a key lookup.
22 *
23 * The only tricky part is that inserts involve renumbering keys past a certain point in the
24 * container.
25 */
26
28
29 /**
30 * \brief Sequence_SparseSortedMapping<T> is a sparse-Array-based concrete implementation of the Sequence<T> container pattern.
31 *
32 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
33 *
34 */
35 template <typename T>
37 private:
38 using inherited = Sequence<T>;
39
40 public:
41 /**
42 * The only non-obvious parameter is 'sparseValue'. This is the special value used internally to
43 * make for the 'sparse' array. These particular values don't require storage.
44 *
45 * Note - this has no externally visible semantics: it just affects the storage usage, and perhaps
46 * performance.
47 */
50 template <typename CONTAINER_OF_T>
51 explicit Sequence_SparseSortedMapping (T sparseValue, const CONTAINER_OF_T& src);
52 template <typename COPY_FROM_ITERATOR_OF_T>
53 explicit Sequence_SparseSortedMapping (T sparseValue, COPY_FROM_ITERATOR_OF_T start, COPY_FROM_ITERATOR_OF_T end);
54
55 public:
57
58 private:
59 class Rep_;
60
61 private:
62 nonvirtual const Rep_& GetRep_ () const;
63 nonvirtual Rep_& GetRep_ ();
64 };
65}
66
67/*
68 ********************************************************************************
69 ******************************* Implementation Details *************************
70 ********************************************************************************
71 */
72
73//#include "Sequence_SparseSortedMapping.inl"
74
75#endif /*_Stroika_Foundation_Containers_Concrete_Sequence_SparseSortedMapping_h_ */
Sequence_SparseSortedMapping<T> is a sparse-Array-based concrete implementation of the Sequence<T> co...
A generalization of a vector: a container whose elements are keyed by the natural numbers.
Definition Sequence.h:187
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.