Dune Core Modules (unstable)

boundschecking.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3#ifndef DUNE_BOUNDSCHECKING_HH
4#define DUNE_BOUNDSCHECKING_HH
5
7
19#ifndef DUNE_ASSERT_BOUNDS
20#if defined(DUNE_CHECK_BOUNDS) || defined(DOXYGEN)
21
30#define DUNE_ASSERT_BOUNDS(cond) \
31 do { \
32 if (!(cond)) \
33 DUNE_THROW(Dune::RangeError, "Index out of bounds."); \
34 } while (false)
35
36#else
37#define DUNE_ASSERT_BOUNDS(cond)
38#endif
39#endif
40
43#endif // DUNE_BOUNDSCHECKING_HH
A few common exception classes.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)