Quantcast
Channel: Why do I need std::get_temporary_buffer? - Stack Overflow
Browsing all 7 articles
Browse latest View live

Answer by Raedwald for Why do I need std::get_temporary_buffer?

For what purpose I should use std::get_temporary_buffer?The function is deprecated in C++17, so the correct answer is now "for no purpose, do not use it".

View Article



Answer by Jeremy for Why do I need std::get_temporary_buffer?

Microsoft's standard library guy says the following (here):Could you perhaps explain when to use 'get_temporary_buffer'It has a very specialized purpose. Note that it doesn't throwexceptions, like new...

View Article

Answer by Daniel Munoz for Why do I need std::get_temporary_buffer?

Perhaps (just a guess) it has something to do with memory fragmentation. If you heavily keep allocating and deallocating temporal memory, but each time you do it you allocate some long-term intended...

View Article

Answer by Georg Fritzsche for Why do I need std::get_temporary_buffer?

Stroustrup says in "The C++ Programming Language" (§19.4.4, SE):The idea is that a system may keep a number of fixed-sized buffers ready for fast allocation so that requesting space for n objects may...

View Article

Answer by OwnWaterloo for Why do I need std::get_temporary_buffer?

ptrdiff_t request = 12pair<int*,ptrdiff_t> p = get_temporary_buffer<int>(request);int* base = p.first;ptrdiff_t respond = p.sencond;assert( is_valid( base, base + respond ) );respond may be...

View Article


Answer by jalf for Why do I need std::get_temporary_buffer?

The standard says it allocates storage for up ton elements.In other words, your example might return a buffer big enough for 5 objects only.It does seem pretty difficult to imagine a good use case for...

View Article

Why do I need std::get_temporary_buffer?

For what purpose I should use std::get_temporary_buffer? Standard says the following:Obtains a pointer to storage sufficient to store up to n adjacent T objects.I thought that the buffer will be...

View Article
Browsing all 7 articles
Browse latest View live




Latest Images