77#include < string>
88#include < type_traits>
99
10+ #include < userver/compiler/impl/lifetime.hpp>
1011#include < userver/dynamic_config/impl/snapshot.hpp>
1112#include < userver/dynamic_config/impl/to_json.hpp>
1213#include < userver/formats/json_fwd.hpp>
@@ -137,7 +138,7 @@ class Snapshot final {
137138
138139 // / Used to access individual configs in the type-safe config map
139140 template <typename VariableType>
140- const VariableType& operator [](const Key<VariableType>& key) const &;
141+ const VariableType& operator [](const Key<VariableType>& key) const & USERVER_IMPL_LIFETIME_BOUND ;
141142
142143 // / Used to access individual configs in the type-safe config map
143144 template <typename VariableType>
@@ -146,7 +147,7 @@ class Snapshot final {
146147 // / @cond
147148 // No longer supported, use `config[key]` instead
148149 template <typename T>
149- const T& Get () const &;
150+ const T& Get () const & USERVER_IMPL_LIFETIME_BOUND ;
150151
151152 // No longer supported, use `config[key]` instead
152153 template <typename T>
@@ -258,7 +259,7 @@ VariableType Key<VariableType>::Parse(const DocsMap& docs_map) const {
258259}
259260
260261template <typename VariableType>
261- const VariableType& Snapshot::operator [](const Key<VariableType>& key) const & {
262+ const VariableType& Snapshot::operator [](const Key<VariableType>& key) const & USERVER_IMPL_LIFETIME_BOUND {
262263 return GetData ().Get <VariableType>(impl::ConfigIdGetter::Get (key));
263264}
264265
@@ -268,7 +269,7 @@ const VariableType& Snapshot::operator[](const Key<VariableType>&) && {
268269}
269270
270271template <typename T>
271- const T& Snapshot::Get () const & {
272+ const T& Snapshot::Get () const & USERVER_IMPL_LIFETIME_BOUND {
272273 return (*this )[T::kDeprecatedKey ];
273274}
274275
0 commit comments