All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
icarus::details::KeyValuesConverter< T, Enable > Struct Template Reference

#include <KeyValuesData.h>

std::optional< T > operator() (std::string const &s) const
 
static std::optional< T > convert (std::string const &s)
 

Detailed Description

template<typename T, typename Enable = void>
struct icarus::details::KeyValuesConverter< T, Enable >

Definition at line 32 of file KeyValuesData.h.

Member Function Documentation

template<typename T , typename Enable = void>
static std::optional<T> icarus::details::KeyValuesConverter< T, Enable >::convert ( std::string const &  s)
inlinestatic

Definition at line 823 of file KeyValuesData.h.

824  {
825  if constexpr (std::is_arithmetic_v<T>) {
826  T number {}; // useless initialization to avoid GCC complains
827  char const *b = s.data(), *e = b + s.length();
828  return (std::from_chars(b, e, number).ptr == e)
829  ? std::make_optional(number): std::nullopt;
830  }
831  else if constexpr(std::is_constructible_v<T, std::string>){
832  return std::make_optional(T{ s });
833  }
834  else return std::nullopt;
835  } // convert()
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
do i e
template<typename T , typename Enable = void>
std::optional<T> icarus::details::KeyValuesConverter< T, Enable >::operator() ( std::string const &  s) const
inline

Convert a string s into a type T; may return std::nullopt on "non-fatal" failure.

Definition at line 820 of file KeyValuesData.h.

821  { return convert(s); }
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
static std::optional< T > convert(std::string const &s)

The documentation for this struct was generated from the following file: