library

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

View the Project on GitHub sash2104/library

:heavy_check_mark: monoid/fill.hpp

Verified with

Code

#ifndef _MONOID_FILL
#define _MONOID_FILL
#include <utility>

namespace monoid {
template <class T>
struct fill {
  typedef std::pair<bool, T> value_t;
  value_t identity() const { return std::make_pair(false, T()); }
  value_t merge(value_t a, value_t b) const { return b.first ? b : a; }
};
} // namespace monoid

#endif // _MONOID_FILL
#line 1 "monoid/fill.hpp"


#include <utility>

namespace monoid {
template <class T>
struct fill {
  typedef std::pair<bool, T> value_t;
  value_t identity() const { return std::make_pair(false, T()); }
  value_t merge(value_t a, value_t b) const { return b.first ? b : a; }
};
} // namespace monoid
Back to top page