MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / aton

Function aton

example/cacheHierarchy/fkYAML/node.hpp:4872–4893  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4870/// @return true if the conversion completes successfully, false otherwise.
4871template <typename CharItr>
4872inline bool aton(CharItr begin, CharItr end, std::nullptr_t& /*unused*/) noexcept {
4873 static_assert(is_iterator_of<CharItr, char>::value, "aton() accepts iterators for char type");
4874
4875 if FK_YAML_UNLIKELY (begin == end) {
4876 return false;
4877 }
4878
4879 const auto len = static_cast<uint32_t>(std::distance(begin, end));
4880
4881 // This path is the most probable case, so check it first.
4882 if FK_YAML_LIKELY (len == 4) {
4883 const char* p_begin = &*begin;
4884 return (std::strncmp(p_begin, "null", 4) == 0) || (std::strncmp(p_begin, "Null", 4) == 0) ||
4885 (std::strncmp(p_begin, "NULL", 4) == 0);
4886 }
4887
4888 if (len == 1) {
4889 return *begin == '~';
4890 }
4891
4892 return false;
4893}
4894
4895/////////////////////////////
4896// scalar <--> boolean //

Callers 1

node.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected