Skip to content

File postget.h

File List > algebra > helpers > postget.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_ALGEBRA_HELPERS_POSTGET_H
#define TEMPLAT_LATTICE_ALGEBRA_HELPERS_POSTGET_H

/* This file is part of TempLat, available at https://cosmolattice.github.io/templat .
   Copyright 2021-2026 The TempLat authors, see AUTHORS.md.
   Released under the MIT license, see LICENSE.md. */

// File info: Main contributor(s): Franz R. Sattler, Year: 2025

#include "TempLat/util/rangeiteration/tag.h"

namespace TempLat
{
  class PostGet
  {
  public:
    // Put public methods here. These should change very little over time.
    template <typename U>
      requires requires(std::decay_t<U> obj) { obj.postGet(); }
    static inline void apply(U &obj)
    {
      obj.postGet();
    }

    template <typename U>
      requires(!requires(std::decay_t<U> obj) { obj.postGet(); })
    static inline void apply(U &)
    {
      // do nothing
    }

    template <typename U, int N>
      requires requires(std::decay_t<U> obj, Tag<N> t) { obj.postGet(t); }
    static inline void apply(U &obj, Tag<N> t)
    {
      obj.postGet(t);
    }

    template <typename U, int N>
      requires(!requires(std::decay_t<U> obj, Tag<N> t) { obj.postGet(t); })
    static inline void apply(U &, Tag<N>)
    {
      // do nothing
    }

    PostGet() = delete;

  private:
    /* Put all member variables and private methods here. These may change arbitrarily. */
  };
} // namespace TempLat

#endif