Skip to content

Commit

Permalink
doxygen
Browse files Browse the repository at this point in the history
Signed-off-by: Snow Pettersen <snowp@lyft.com>
  • Loading branch information
snowp committed Dec 14, 2020
1 parent 3d4a755 commit f52e870
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/envoy/common/optref.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,18 @@ template <class T> struct OptRef : public absl::optional<std::reference_wrapper<
const T& ref() const { return **this; }
};

/**
* Constructs an OptRef<T> from the provided reference.
* @param ref the reference to wrap
* @return OptRef<T> the wrapped reference
*/
template <class T> OptRef<T> makeOptRef(T& ref) { return {ref}; }

/**
* Constructs an OptRef<T> from the provided pointer.
* @param ptr the pointer to wrap
* @return OptRef<T> the wrapped pointer, or absl::nullopt if the pointer is nullptr
*/
template <class T> OptRef<T> makeOptRefFromPtr(T* ptr) {
if (ptr == nullptr) {
return {};
Expand Down

0 comments on commit f52e870

Please sign in to comment.