dlib::matrix : expression template temporary objects : use std::shared_ptr ? #2789
Closed
pfeatherstone
started this conversation in
Ideas
Replies: 2 comments 9 replies
-
|
Side note, this refers to the whole discussion about optimizing dot products on circular buffers. If there were a specialisation of |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
That would require every operation do a dynamic allocation though, which would slow them down a ton. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It's my understanding that the expression template engine stores temporary objects as normal value types. That means you can't store a sub-expression using
autokeyword since you would get dangling references to destroyed objects.How about we store temporary objects with
std::shared_ptr?This means you would be able to store expressions using
auto. Now I realise this may be bad practice bad I would like to do something like this:Currently this is illegal but using
shared_ptrunder the hood would be fine.This makes writing custom expression templates more composable in my opinion because you can refactor recurring expressions into sub-expressions without having to write it out manually every time you use it or having to write a custom
matrix_opobject.Beta Was this translation helpful? Give feedback.
All reactions