OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
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 
23 template<typename T> void boost_check_array(const T * ptr1, const T * ptr2, size_t sz)
24 {
25  // Check the array
26  for (size_t i = 0 ; i < sz ; i++)
27  {
28  BOOST_REQUIRE_EQUAL(ptr1[i],ptr2[i]);
29  }
30 }
31 
32 #include <typeinfo>
33 
34 #include <cxxabi.h>
35 
42 static std::string demangle(const char* name) {
43 
44  int status = -4; // some arbitrary value to eliminate the compiler warning
45 
46  // enable c++11 by passing the flag -std=c++11 to g++
47  std::unique_ptr<char, void(*)(void*)> res {
48  abi::__cxa_demangle(name, NULL, NULL, &status),
49  std::free
50  };
51 
52  return (status==0) ? res.get() : name ;
53 }
54 
55 #endif