/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/prelude.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/prelude.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
prelude.hh
Go to the documentation of this file.
1#pragma once
2
3// Force-included into every C++ translation unit of DiFfRG and of every consumer
4// of the exported target (see setup_target() in cmake/setup_build_system.cmake).
5// It collects the workarounds that have to be in effect before any other header
6// is parsed, so it has to stay self-contained and cheap.
7//
8// Only a single -include option may be used: CMake de-duplicates the repeated
9// "-include" token of a second one and orphans its file name, which the compiler
10// then treats as an additional input file.
11
12// deal.II's tensor.h uses assert() without including <cassert>.
13#include <cassert>
14
15// nvcc, observed with CUDA 13.x driving the libstdc++ 13 headers in C++20 mode,
16// mis-handles the constrained partial specialization
17//
18// template <typename T> requires std::is_object_v<T> struct iterator_traits<T *>;
19//
20// Its frontend fails to select the specialization when std::iterator_traits<char *>
21// is first required from a deferred parsing context -- in particular from a default
22// argument that materialises a std::string, which is exactly what deal.II's
23// DeclExceptionMsg macro expands to:
24//
25// Exception(const std::string &msg = "some text") : arg(msg) {}
26//
27// Every translation unit that pulls in <deal.II/base/exceptions.h> before the
28// specialization has been completed then drowns in "incomplete type
29// std::iterator_traits<char *>" errors from <bits/stl_iterator.h>. Completing the
30// specialization eagerly, ahead of every other header, makes the frontend record
31// the correct instantiation and the errors disappear.
32#if defined(__CUDACC__)
33
34#include <iterator>
35
36namespace DiFfRG
37{
38 namespace detail
39 {
40 using nvcc_iterator_traits_fix = std::iterator_traits<char *>::value_type;
41 }
42} // namespace DiFfRG
43
44#endif
std::iterator_traits< char * >::value_type nvcc_iterator_traits_fix
Definition prelude.hh:40
Definition complex_math.hh:10