mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 22:00:33 +05:00
save index bypasses range-check
This commit is contained in:
parent
8f762bc33d
commit
3c9f98b38d
@ -99,9 +99,17 @@ namespace ngcore
|
|||||||
// Convenience macro to append file name and line of exception origin to the string
|
// Convenience macro to append file name and line of exception origin to the string
|
||||||
#define NG_EXCEPTION(s) ngcore::Exception(__FILE__ ":" NETGEN_CORE_NGEXEPTION_STR(__LINE__) "\t"+std::string(s))
|
#define NG_EXCEPTION(s) ngcore::Exception(__FILE__ ":" NETGEN_CORE_NGEXEPTION_STR(__LINE__) "\t"+std::string(s))
|
||||||
|
|
||||||
|
// template <typename T> constexpr bool IsSave() { return false; }
|
||||||
|
template <typename T>
|
||||||
|
struct IsSave
|
||||||
|
{
|
||||||
|
constexpr operator bool() const { return false; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined(NETGEN_ENABLE_CHECK_RANGE) && !defined(__CUDA_ARCH__)
|
#if defined(NETGEN_ENABLE_CHECK_RANGE) && !defined(__CUDA_ARCH__)
|
||||||
#define NETGEN_CHECK_RANGE(value, min, max_plus_one) \
|
#define NETGEN_CHECK_RANGE(value, min, max_plus_one) \
|
||||||
{ if ((value)<(min) || (value)>=(max_plus_one)) \
|
{ if constexpr (!IsSave<decltype(value)>()) if ((value)<(min) || (value)>=(max_plus_one)) \
|
||||||
ThrowRangeException(__FILE__ ":" NETGEN_CORE_NGEXEPTION_STR(__LINE__) "\t", int(value), int(min), int(max_plus_one)); }
|
ThrowRangeException(__FILE__ ":" NETGEN_CORE_NGEXEPTION_STR(__LINE__) "\t", int(value), int(min), int(max_plus_one)); }
|
||||||
// #define NETGEN_CHECK_SHAPE(a,b) \
|
// #define NETGEN_CHECK_SHAPE(a,b) \
|
||||||
// { if(a.Shape() != b.Shape()) \
|
// { if(a.Shape() != b.Shape()) \
|
||||||
|
Loading…
Reference in New Issue
Block a user