kyopro-lib

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

View on GitHub

:heavy_check_mark: Fixed point combinator
(Mylib/Utils/fix_point.cpp)

Operations

Requirements

Notes

Problems

References

Verified with

Code

#pragma once
#include <utility>

namespace haar_lib {
  template <typename F>
  struct fix_point : F {
    explicit constexpr fix_point(F &&f) noexcept : F(std::forward<F>(f)) {}

    template <typename... Args>
    constexpr auto operator()(Args &&... args) const {
      return F::operator()(*this, std::forward<Args>(args)...);
    }
  };

  template <typename F>
  inline constexpr auto make_fix_point(F &&f) {
    return fix_point<F>(std::forward<F>(f));
  }

  template <typename F>
  inline constexpr auto make_fix_point(F &f) {
    return fix_point<F>(std::forward<F>(f));
  }
}  // namespace haar_lib
#line 2 "Mylib/Utils/fix_point.cpp"
#include <utility>

namespace haar_lib {
  template <typename F>
  struct fix_point : F {
    explicit constexpr fix_point(F &&f) noexcept : F(std::forward<F>(f)) {}

    template <typename... Args>
    constexpr auto operator()(Args &&... args) const {
      return F::operator()(*this, std::forward<Args>(args)...);
    }
  };

  template <typename F>
  inline constexpr auto make_fix_point(F &&f) {
    return fix_point<F>(std::forward<F>(f));
  }

  template <typename F>
  inline constexpr auto make_fix_point(F &f) {
    return fix_point<F>(std::forward<F>(f));
  }
}  // namespace haar_lib
Back to top page