| 1234567891011121314151617181920212223242526272829303132 |
- //
- // forwards.h
- // string-utils
- //
- // Created by Sam Jaffe on 6/12/22.
- // Copyright © 2022 Sam Jaffe. All rights reserved.
- //
- #pragma once
- #include "string_utils/traits.h"
- namespace string_utils {
- class Tokenizer;
- class EscapedTokenizer;
- // A helper object for providing partial specializations for casting
- template <typename, typename = void> struct cast_helper;
- // The main parser
- template <typename T> std::pair<T, bool> cast(std::string_view str) noexcept;
- template <typename T, typename S>
- std::pair<T, bool> cast(std::vector<S> const & str) noexcept;
- template <
- typename S, typename T,
- typename = std::enable_if_t<detail::has_result<cast_helper<T>(S, T &)>{}>>
- bool cast(S const & str, T & to) noexcept {
- return cast_helper<T>{}(str, to);
- }
- }
|