Amesos2 - Direct Sparse Solver Interfaces Version of the Day
Amesos2_ctassert.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Amesos2: Templated Direct Sparse Solver Package
4//
5// Copyright 2011 NTESS and the Amesos2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10
19/* ETB: I think the Teuchos CompileTimeAssert class is backwards
20 * (i.e. if the test evaluates to true, a compile-time error is
21 * thrown), so I'm defining my own.
22 *
23 * This definition is based off a Dr Dobb's article on compile-time
24 * assertions.
25 */
26
27#ifndef AMESOS2_CTASSERT_HPP
28#define AMESOS2_CTASSERT_HPP
29
30namespace Amesos2{
31
32 template <bool assertion>
33 struct ctassert {
34 enum { N = 1 - 2*int(!assertion) };
35 // 1 if assertion is true
36 // -1 if assertion is false
37 static char A[N];
38 };
39
40 template <bool assertion>
41 char ctassert<assertion>::A[N];
42
43}
44
45#endif // AMESOS2_CTASSERT_HPP