Dune Core Modules (2.9.1)

assertandreturn.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_COMMON_ASSERTANDRETURN_HH
6#define DUNE_COMMON_ASSERTANDRETURN_HH
7
8#include <cassert>
9
11
19#ifdef NDEBUG
20 #define DUNE_ASSERT_AND_RETURN(C,X) X
21#else
22 #define DUNE_ASSERT_AND_RETURN(C,X) (!(C) ? throw [&](){assert(!#C);return 0;}() : 0), X
23#endif
24
25
26
27#endif // DUNE_COMMON_ASSERTANDRETURN_HH
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)