KA
я хочу получить указатель, который сохранил внутри storage, приведëнный к T*
Size: a a a
KA
DV
*reinterpret_cast<T**>(&storage)
:)KA
*reinterpret_cast<T**>(&storage)
:)SE
*reinterpret_cast<T**>(&storage)
:)AK
*reinterpret_cast<T**>(&storage)
:)АК
NP
NP
АК
NP
m
АК
#define MAKE_VAR(X) int X
.macro.h
и положить макрос туда. Тогда саму библиотеку пользователь будет импортировать как import lib
, а если ему нужен макрос, то import "lib/macro.h"
- так?m
#define MAKE_VAR(X) int X
.macro.h
и положить макрос туда. Тогда саму библиотеку пользователь будет импортировать как import lib
, а если ему нужен макрос, то import "lib/macro.h"
- так?АК
A
DV
KA
template <typename R, typename... Args>
template <typename T>
T const* storage<R, Args...>::get_dynamic() const noexcept {
return *reinterpret_cast<T const**>(&buf);
}
bufferэто
storage
/home/kirill/CLionProjects/some_shit.h:199:13: error: reinterpret_cast from 'const inplace_buffer *' (aka 'const std::aligned_storage<8, 8>::type *') to 'const small_func **' casts away qualifiers
return *reinterpret_cast<T const**>(&buf);
DV
template <typename R, typename... Args>
template <typename T>
T const* storage<R, Args...>::get_dynamic() const noexcept {
return *reinterpret_cast<T const**>(&buf);
}
bufferэто
storage
/home/kirill/CLionProjects/some_shit.h:199:13: error: reinterpret_cast from 'const inplace_buffer *' (aka 'const std::aligned_storage<8, 8>::type *') to 'const small_func **' casts away qualifiers
return *reinterpret_cast<T const**>(&buf);
нужен *reinterpret_cast<T* const*>(&buf)