kyopro-lib

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

View on GitHub

:warning: ends_with
(Mylib/String/ends_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 ends_with(const Container &str, const Container &suffix) {
    if (str.size() < suffix.size()) return false;
    int n = str.size(), m = suffix.size();
    for (size_t i = 0; i < suffix.size(); ++i) {
      if (str[n - 1 - i] != suffix[m - 1 - i]) return false;
    }
    return true;
  }
}  // namespace haar_lib
#line 2 "Mylib/String/ends_with.cpp"
#include <cstddef>

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