NeoN
A framework for CFD software
Loading...
Searching...
No Matches
demangle.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 - 2025 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6// TODO For WIN builds, needs to be ifdef'ed out.
7#ifdef __GNUC__
8#include <cxxabi.h>
9#endif
10#include <string>
11#include <any>
12#include <iostream>
13
14namespace NeoN
15{
16
17std::string demangle(const char* mangledName);
18
19template<typename T, typename Container, typename Key>
20void logBadAnyCast(const std::bad_any_cast& e, const Key& key, const Container& data)
21{
22 std::cerr << "Caught a bad_any_cast exception: \n"
23 << "key " << key << "\n"
24 << "requested type " << demangle(typeid(T).name()) << "\n"
25 << "actual type " << demangle(data.at(key).type().name()) << "\n"
26 << e.what() << std::endl;
27}
28
29}
Definition array.hpp:20
std::string demangle(const char *mangledName)
const std::string & name(const NeoN::Document &doc)
Retrieves the name of a Document.
void logBadAnyCast(const std::bad_any_cast &e, const Key &key, const Container &data)
Definition demangle.hpp:20