Changeset a0d83b4 in Lumiera
- Timestamp:
-
2026-04-07T23:53:53Z
(2 weeks ago)
- Author:
- Ichthyostega <prg@…>
- Branches:
- dev/play
- Children:
- 2c8ee05
- Parents:
- 0760525
- git-author:
- Ichthyostega <prg@…> (07/04/26 21:28:44)
- git-committer:
- Ichthyostega <prg@…> (07/04/26 23:53:53)
- Message:
-
Library: investigate design for an opaque inline functor
This is a design study to find out what would be required
to build an opaque function wrapper, similar to std::function,
yet without using any heap memory ever.
Such a building block would allow for some interesting options
for a well structured design of elaborate data structures.
This changeset provides an implementation draft.
Two important findings to note:
- it is impossible to get away with just a single function pointer
- because at the very least we need to invoke the destructor of the
embedded delegate. Thus something akin to a "manager" is required.
- this implies that the component would not be so efficient as I hoped,
since it requires two pointers and requires to emit code for each
type of delegate.
- by making the component NonCopyable, I avoided the complexities
of virtual copy support. In case the latter is desired, it would be
much simpler to switch to a classical OO approach with a VTable
and use our
PolymorphicValue wrapper to handle copy and cloning.
-
(No files)
-