a-canary commented on a change in pull request #6650:
URL: https://github.com/apache/trafficserver/pull/6650#discussion_r412260462
##########
File path: doc/developer-guide/internal-libraries/Extendible.en.rst
##########
@@ -80,18 +80,19 @@ the type's constructor, destructor, and serializer. And to
avoid corruption, the
}
-When an derived class is instantiated, :func:`template<> alloc()` will
allocate a block of memory for the derived class and all added
-fields. The only memory overhead per instance is an uint16 used as a offset to
the start of the extendible block.
+When an derived class is instantiated, :func:`template<> create()` will
allocate a block of memory for the derived class and all added
+fields. The only memory overhead per instance is an uint16 used as a offset to
the start of the extendible block. Then the constructor of the class
+is called, followed by the constructors of each extendible field.
.. code-block:: cpp
ExtendibleExample* alloc_example() {
- return ext::alloc<ExtendibleExample>();
+ return ext::create<ExtendibleExample>();
Review comment:
I like that thought, but make_shared takes a pre-allocated class and
returns an enhanced pointer to it, so it's not a perfect match. It would be
interesting to make a type of extendible to work that way, but you lose the
benefits of continuous memory. `allocate_shared<T>()` is closer to what I'm
doing here. But I renamed 'from `alloc` to `create` to callout that it doesn't
just return a memory chunk, it has constructed and initialized all fields and
internal offsets.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]