/*+ ARES/HADES/BORG Package -- ./libLSS/tools/checkmem.hpp Copyright (C) 2014-2020 Guilhem Lavaux Copyright (C) 2009-2020 Jens Jasche Additional contributions from: Guilhem Lavaux (2023) +*/ #ifndef __LIBLSS_CHECKMEM_HPP #define __LIBLSS_CHECKMEM_HPP /* Stackoverflow: http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence */ #define HAS_MEM_FUNC(func, name) \ template \ struct name { \ typedef char yes[1]; \ typedef char no [2]; \ template struct type_check; \ template static yes &chk(type_check *); \ template static no &chk(...); \ static bool const value = sizeof(chk(0)) == sizeof(yes); \ } #endif