sgi-stl | SGI implement | Graphics library
kandi X-RAY | sgi-stl Summary
kandi X-RAY | sgi-stl Summary
这个是SGI(Silicon Graphics Computer Systems, Inc.)版本的STL实现,是侯捷老师最推荐的可读性最高的一种STL实现。GCC 中用的就是这个版本的实现。.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sgi-stl
sgi-stl Key Features
sgi-stl Examples and Code Snippets
Community Discussions
Trending Discussions on sgi-stl
QUESTION
When I read the source code of SGI/STL, I notice that
...ANSWER
Answered 2020-Oct-16 at 07:36This allocator uses an 8-byte header in front of every allocation to record its size. It is common to store metadata like this next to the actual allocation. Even though the header contains a 4-byte int, 8 bytes ensure that the returned pointer is aligned to 8 bytes, a common requirement for larger types..
As you can read from the code, allocate asks for n+8 bytes (call the resulting allocation p) , stores the size at the the beginning and returns p+8.
Deallocate and reallocate are given the pointer p+8,so have to first subtract to get back to the real allocation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sgi-stl
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page