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.
18 lines
256 B
C++
18 lines
256 B
C++
#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
|