Skip to content

File hasstringmethod.h

File List > algebra > helpers > hasstringmethod.h

Go to the documentation of this file

#ifndef TEMPLAT_LATTICE_ALGEBRA_HASSTRINGMETHOD_H
#define TEMPLAT_LATTICE_ALGEBRA_HASSTRINGMETHOD_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): Wessel Valkenburg, Franz R. Sattler, Year: 2026

#include <type_traits>

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

namespace TempLat
{
  template <class T>
  concept HasStringMethod = requires(std::decay_t<T> t) { t.toString(); };

  template <class T>
  concept HasNoStringMethod = !HasStringMethod<T>;

  template <int N, class T>
  concept HasStringMethodIndexed = requires(std::decay_t<T> t, Tag<N> tag) { t.toString(tag); };

  template <int N, class T>
  concept HasNoStringMethodIndexed = !HasStringMethodIndexed<N, T>;
} // namespace TempLat

#endif