/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include #include #include template struct cmConstStack::Entry { Entry(std::shared_ptr parent, T value) : Value(std::move(value)) , Parent(std::move(parent)) { } T Value; std::shared_ptr Parent; }; template cmConstStack::cmConstStack() = default; template Stack cmConstStack::Push(T value) const { return Stack(this->TopEntry, std::move(value)); } template Stack cmConstStack::Pop() const { assert(this->TopEntry); return Stack(this->TopEntry->Parent); } template T const& cmConstStack::Top() const { assert(this->TopEntry); return this->TopEntry->Value; } template bool cmConstStack::Empty() const { return !this->TopEntry; } template cmConstStack::cmConstStack(std::shared_ptr parent, T value) : TopEntry( std::make_shared(std::move(parent), std::move(value))) { } template cmConstStack::cmConstStack(std::shared_ptr top) : TopEntry(std::move(top)) { }