On Wed, 19 Feb 2025 19:15:18 +0200
Michael S <already5chosen@yahoo.com> wibbled:
On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
Reimplementing double-linked list is fine if all you need is
double-linked list. It does not take more than 20 minutes and typically
you end up with code that fits requirements better than when you
take it from somebody else.
Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >where to start if asked to do it. As for them implementing a dynamic array >using realloc(), pffft , forget it. Not that I'd bother now of course.
On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
wrote:
On Wed, 19 Feb 2025 19:15:18 +0200
Michael S <already5chosen@yahoo.com> wibbled:
On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
Reimplementing double-linked list is fine if all you need is
double-linked list. It does not take more than 20 minutes and typically
you end up with code that fits requirements better than when you
take it from somebody else.
Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >> where to start if asked to do it. As for them implementing a dynamic array >> using realloc(), pffft , forget it. Not that I'd bother now of course.
You cannot implement std::vector in terms of realloc().
On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
wrote:
On Wed, 19 Feb 2025 19:15:18 +0200
Michael S <already5chosen@yahoo.com> wibbled:
On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
Reimplementing double-linked list is fine if all you need is >>>double-linked list. It does not take more than 20 minutes and typically >>>you end up with code that fits requirements better than when you
take it from somebody else.
Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>where to start if asked to do it. As for them implementing a dynamic array >>using realloc(), pffft , forget it. Not that I'd bother now of course.
You cannot implement std::vector in terms of realloc().
On 20.02.2025 19:39, Mr Flibble wrote:
On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
wrote:
On Wed, 19 Feb 2025 19:15:18 +0200
Michael S <already5chosen@yahoo.com> wibbled:
On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
Reimplementing double-linked list is fine if all you need is
double-linked list. It does not take more than 20 minutes and typically >>>> you end up with code that fits requirements better than when you
take it from somebody else.
Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>> where to start if asked to do it. As for them implementing a dynamic array >>> using realloc(), pffft , forget it. Not that I'd bother now of course.
You cannot implement std::vector in terms of realloc().
You can, for trivially relocatable types, which means most of the C++
value types even if they have non-trivial ctors and dtors. There is a
C++26 proposal for formalizing that concept >(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html).
Not sure if using specifically realloc would be a good idea though, I
guess with current trends of massive multithreading and fixed size >allocation pools there probably is no benefit in using realloc over an >explicit malloc+memcpy.
On Thu, 20 Feb 2025 17:39:44 +0000
Mr Flibble <leigh@i42.co.uk> wibbled:
On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
wrote:
On Wed, 19 Feb 2025 19:15:18 +0200
Michael S <already5chosen@yahoo.com> wibbled:
On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
Reimplementing double-linked list is fine if all you need is >>>>double-linked list. It does not take more than 20 minutes and typically >>>>you end up with code that fits requirements better than when you
take it from somebody else.
Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>>where to start if asked to do it. As for them implementing a dynamic array >>>using realloc(), pffft , forget it. Not that I'd bother now of course.
You cannot implement std::vector in terms of realloc().
Sure youy can , its just an allocator that attempts to extend currently >allocated memory. Its absolutely what you'd use in a vector type for operations
like push_back though obviously its not the whole solution.
On 20.02.2025 19:39, Mr Flibble wrote:
On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
wrote:
On Wed, 19 Feb 2025 19:15:18 +0200
Michael S <already5chosen@yahoo.com> wibbled:
On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
Reimplementing double-linked list is fine if all you need is
double-linked list. It does not take more than 20 minutes and typically >>>> you end up with code that fits requirements better than when you
take it from somebody else.
Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know >>> where to start if asked to do it. As for them implementing a dynamic array >>> using realloc(), pffft , forget it. Not that I'd bother now of course.
You cannot implement std::vector in terms of realloc().
You can, for trivially relocatable types, which means most of the C++
value types even if they have non-trivial ctors and dtors. There is a
C++26 proposal for formalizing that concept >(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html).
Not sure if using specifically realloc would be a good idea though, I
guess with current trends of massive multithreading and fixed size >allocation pools there probably is no benefit in using realloc over an >explicit malloc+memcpy.
On Thu, 20 Feb 2025 22:39:31 +0200, Paavo Helde <eesnimi@osa.pri.ee>
wrote:
On 20.02.2025 19:39, Mr Flibble wrote:
On Thu, 20 Feb 2025 08:51:13 -0000 (UTC), Muttley@DastardlyHQ.org
wrote:
On Wed, 19 Feb 2025 19:15:18 +0200
Michael S <already5chosen@yahoo.com> wibbled:
On Wed, 19 Feb 2025 15:58:48 -0000 (UTC)
Reimplementing double-linked list is fine if all you need is
double-linked list. It does not take more than 20 minutes and typically >>>>> you end up with code that fits requirements better than when you
take it from somebody else.
Sure, its pretty simple. But a lot of younger C++ only coders wouldn't know
where to start if asked to do it. As for them implementing a dynamic array >>>> using realloc(), pffft , forget it. Not that I'd bother now of course.
You cannot implement std::vector in terms of realloc().
You can, for trivially relocatable types, which means most of the C++ >>value types even if they have non-trivial ctors and dtors. There is a >>C++26 proposal for formalizing that concept >>(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2786r11.html).
Not sure if using specifically realloc would be a good idea though, I >>guess with current trends of massive multithreading and fixed size >>allocation pools there probably is no benefit in using realloc over an >>explicit malloc+memcpy.
std::vector value_type can be non-relocatable type ergo you cannot
implement std::vector in terms of realloc for all types ergo you
cannot implement std::vector in terms of realloc.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,029 |
Nodes: | 10 (1 / 9) |
Uptime: | 182:15:14 |
Calls: | 13,337 |
Calls today: | 4 |
Files: | 186,574 |
D/L today: |
5,448 files (1,505M bytes) |
Messages: | 3,356,610 |