OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
util_debug.hpp
1/*
2 * util.hpp
3 *
4 * Created on: Nov 20, 2014
5 * Author: Pietro Incardona
6 */
7
8#ifndef UTIL_DEBUG_HPP
9#define UTIL_DEBUG_HPP
10
11#include <memory>
12#include <string>
13#include <cstdlib>
14
25template<typename T> void boost_check_array(const T * ptr1, const T * ptr2, size_t sz)
26{
27 // Check the array
28 for (size_t i = 0 ; i < sz ; i++)
29 {
30 BOOST_REQUIRE_EQUAL(ptr1[i],ptr2[i]);
31 }
32}
33
34#include <typeinfo>
35
36#include <cxxabi.h>
37
44static inline std::string demangle(const char* name) {
45
46 int status = -4; // some arbitrary value to eliminate the compiler warning
47
48 // enable c++11 by passing the flag -std=c++11 to g++
49 std::unique_ptr<char, void(*)(void*)> res {
50 abi::__cxa_demangle(name, NULL, NULL, &status),
51 std::free
52 };
53
54 return (status==0) ? res.get() : name ;
55}
56
57#endif