Код: Выделить всё
template
void _Start(_Fn&& _Fx, _Args&&... _Ax) {
using _Tuple = tuple;
auto _Decay_copied = _STD make_unique(_STD forward(_Fx), _STD forward(_Ax)...);
constexpr auto _Invoker_proc = _Get_invoke(make_index_sequence{});
_Thr._Hnd =
reinterpret_cast(_CSTD _beginthreadex(nullptr, 0, _Invoker_proc, _Decay_copied.get(), 0, &_Thr._Id));
if (_Thr._Hnd) { // ownership transferred to the thread
(void) _Decay_copied.release();
} else { // failed to start thread
_Thr._Id = 0;
_Throw_Cpp_error(_RESOURCE_UNAVAILABLE_TRY_AGAIN);
}
}
Код: Выделить всё
auto _Decay_copied = _STD make_unique(_STD forward(_Fx), _STD forward(_Ax)...);
Я сделал следующее попытки:
Код: Выделить всё
#include
#include
#include
template
void add(T&& t)
{
std::vector decay_copid{std::forward(t)};
decay_copid[0]++;
}
template
void wrapper(T&& t)
{
add(std::forward(t));
}
int main() {
double d = 1.0;
double& ref = d;
std::tuple test{ref};
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78745702/are-stl-containers-assigned-by-copy[/url]