Skip to content

File iscomposite.h

File List > code_source > templat > include > TempLat > util > iscomposite.h

Go to the documentation of this file

#ifndef TEMPLAT_UTIL_ISCOMPOSITE_H
#define TEMPLAT_UTIL_ISCOMPOSITE_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): Adrien Florio, Year: 2019

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

namespace TempLat
{
  template <class, int N> struct IsCompositeHelper : std::true_type {
  };

  // specialization recognizes types that do have a nested ::type member:
  template <class T> struct IsCompositeHelper<T, 1> : std::false_type {
  };

  template <typename R>
  using IsComposite = IsCompositeHelper<R, tuple_size<decltype(std::remove_reference<R>::type::Getter::get(
                                               std::declval<R &>(), std::declval<Tag<0>>()))>::value>;

} // namespace TempLat

#endif