Skip to content

src/application/impl/config_reader/pt_util.hpp

Namespaces

Name
sgns
sgns::application

Functions

Name
template <typename T >
outcome::result< std::decay_t< T > >
ensure(boost::optional< T > opt_entry)

Functions Documentation

function ensure

template <typename T >
outcome::result< std::decay_t< T > > ensure(
    boost::optional< T > opt_entry
)

Source code

#ifndef SUPERGENIUS_APPLICATION_UTIL_HPP
#define SUPERGENIUS_APPLICATION_UTIL_HPP

#include <boost/optional.hpp>
#include "application/impl/config_reader/error.hpp"

namespace sgns::application {

  template <typename T>
  outcome::result<std::decay_t<T>> ensure(boost::optional<T> opt_entry) {
    if (! opt_entry) {
      return ConfigReaderError::MISSING_ENTRY;
    }
    return opt_entry.value();
  }

}  // namespace sgns::application

#endif  // SUPERGENIUS_APPLICATION_UTIL_HPP

Updated on 2026-03-04 at 13:10:44 -0800