library

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

View the Project on GitHub matumoto1234/library

:warning: tools/counter.hpp

Depends on

Code

#pragma once

#include "./base.hpp"

#include <map>

namespace matumoto {
  template <typename Iterator>
  auto counter(Iterator first, Iterator last) {
    using T = remove_reference_t<decltype(*first)>;
    map<T, int> res;
    for (auto it = first; it != last; it++) {
      T value = *it;
      res[value]++;
    }
    return res;
  }
} // namespace matumoto
#line 2 "tools/counter.hpp"

#line 2 "tools/base.hpp"

namespace matumoto {
  using namespace std;
}
#line 4 "tools/counter.hpp"

#include <map>

namespace matumoto {
  template <typename Iterator>
  auto counter(Iterator first, Iterator last) {
    using T = remove_reference_t<decltype(*first)>;
    map<T, int> res;
    for (auto it = first; it != last; it++) {
      T value = *it;
      res[value]++;
    }
    return res;
  }
} // namespace matumoto
Back to top page