| 52 | |
| 53 | template<typename T, typename Alloc = std::allocator<T>> |
| 54 | const T *data(const std::vector<T, Alloc> &v) { |
| 55 | // Eventually the returned pointer gets passed down to memcpy, so |
| 56 | // we need it to be non-null to avoid undefined behavior. |
| 57 | static uint8_t t; |
| 58 | return v.empty() ? reinterpret_cast<const T *>(&t) : &v.front(); |
| 59 | } |
| 60 | template<typename T, typename Alloc = std::allocator<T>> |
| 61 | T *data(std::vector<T, Alloc> &v) { |
| 62 | // Eventually the returned pointer gets passed down to memcpy, so |
no test coverage detected