split.h 407 B

123456789101112131415161718
  1. #pragma once
  2. #include <tuple>
  3. #include <utility>
  4. #include "string_utils/cast.h"
  5. #include "string_utils/tokenizer.h"
  6. namespace string_utils {
  7. template <typename Tuple>
  8. struct cast_helper<Tuple, std::enable_if_t<detail::is_tuple<Tuple>{}>> {
  9. bool operator()(std::string_view str, Tuple &to) const noexcept {
  10. return maybe_cast<detail::decay_t<Tuple>>(tokenizer(",")(std::string(str)), to);
  11. }
  12. };
  13. }