File gettoolbox.h
File List > algebra > helpers > gettoolbox.h
Go to the documentation of this file
#ifndef TEMPLAT_LATTICE_ALGEBRA_HELPERS_GETTOOLBOX_H
#define TEMPLAT_LATTICE_ALGEBRA_HELPERS_GETTOOLBOX_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, Year: 2019
#include "TempLat/lattice/algebra/helpers/hastoolbox.h"
#include "TempLat/lattice/algebra/helpers/getstring.h"
namespace TempLat
{
MakeException(GetToolBoxException);
class GetToolBox
{
public:
GetToolBox() = delete;
// Put public methods here. These should change very little over time.
template <typename U>
requires HasToolBox<U>
static auto get(U &&obj)
{
return obj.getToolBox();
}
template <typename U>
requires(!HasToolBox<U>)
static std::nullptr_t get(U &&obj)
{
throw GetToolBoxException("Object does not have a toolbox: " + GetString::get(obj));
return std::nullptr_t();
}
};
} // namespace TempLat
#endif