kyopro-lib

This documentation is automatically generated by online-judge-tools/verification-helper

View on GitHub

:warning: starts_with
(Mylib/String/starts_with.cpp)

Operations

Requirements

Notes

Problems

References

Code

#pragma once
#include <cstddef>

namespace haar_lib {
  template <typename Container, typename T = typename Container::value_type>
  bool starts_with(const Container &str, const Container &prefix) {
    if (str.size() < prefix.size()) return false;
    for (size_t i = 0; i < prefix.size(); ++i) {
      if (str[i] != prefix[i]) return false;
    }
    return true;
  }
}  // namespace haar_lib
#line 2 "Mylib/String/starts_with.cpp"
#include <cstddef>

namespace haar_lib {
  template <typename Container, typename T = typename Container::value_type>
  bool starts_with(const Container &str, const Container &prefix) {
    if (str.size() < prefix.size()) return false;
    for (size_t i = 0; i < prefix.size(); ++i) {
      if (str[i] != prefix[i]) return false;
    }
    return true;
  }
}  // namespace haar_lib
Back to top page