version 3.10-dev
state.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_TYPETRAITS_STATE_HH
13#define DUMUX_TYPETRAITS_STATE_HH
14
15#include <dune/common/std/type_traits.hh>
16
17namespace Dumux::Detail {
18
21{
22 template<class PrimaryVariables>
23 auto operator()(PrimaryVariables&& priVars)
24 -> decltype(priVars.state())
25 {}
26};
27
28template<class P>
29using DetectPriVarsHaveState = decltype(std::declval<P>().state());
30
31template<class P>
32constexpr inline bool priVarsHaveState()
33{ return Dune::Std::is_detected<DetectPriVarsHaveState, P>::value; }
34
35} // end namespace Dumux::Detail
36
37#endif
Distance implementation details.
Definition: cvfelocalresidual.hh:25
constexpr bool priVarsHaveState()
Definition: state.hh:32
decltype(std::declval< P >().state()) DetectPriVarsHaveState
Definition: state.hh:29
helper struct detecting if a PrimaryVariables object has a state() function
Definition: state.hh:21
auto operator()(PrimaryVariables &&priVars) -> decltype(priVars.state())
Definition: state.hh:23