[Glacier] Add a binary tree implementation.
Additionally add an optional class to return found values in the tree. And a reference container (Ref) similar to std::reference_wrapper to allow storing references in containers.
This commit is contained in:
parent
26b61db021
commit
98f029ae23
4 changed files with 234 additions and 0 deletions
18
lib/glacier/memory/reference.h
Normal file
18
lib/glacier/memory/reference.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
namespace glcr {
|
||||
|
||||
template <typename T>
|
||||
class Ref {
|
||||
public:
|
||||
Ref(T& ref) : ref_(ref) {}
|
||||
Ref(const Ref& other) = default;
|
||||
Ref(Ref&& other) = default;
|
||||
|
||||
operator T&() const { return ref_; }
|
||||
|
||||
private:
|
||||
T& ref_;
|
||||
};
|
||||
|
||||
} // namespace glcr
|
||||
Loading…
Add table
Add a link
Reference in a new issue