MCPcopy Create free account
hub / github.com/ArashPartow/exprtk / vector_access_rtc

Class vector_access_rtc

exprtk_simple_example_20.cpp:28–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27
28struct vector_access_rtc : public exprtk::vector_access_runtime_check
29{
30 typedef std::map<void*, std::string> map_t;
31 map_t vector_map;
32
33 bool handle_runtime_violation(violation_context& context)
34 {
35 const map_t::iterator itr = vector_map.find(static_cast<void*>(context.base_ptr));
36 std::string vector_name = (itr != vector_map.end()) ?
37 itr->second : "Unknown" ;
38
39 printf("Runtime vector access violation\n"
40 "Vector: %s base: %p end: %p access: %p typesize: %d\n",
41 vector_name.c_str(),
42 context.base_ptr ,
43 context.end_ptr ,
44 context.access_ptr ,
45 static_cast<unsigned int>(context.type_size));
46
47 throw std::runtime_error
48 ("Runtime vector access violation. Vector: " + vector_name);
49
50 return false;
51 }
52};
53
54template <typename T>
55void vector_overflow_example()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected