Open Un-done opened 1 year ago
Emplace could be changed have both const and non-const reference parameters.
Yeah, I remembered the cases where const
has to be there. So duplication seems unavoidable.
I'm not sure if it makes sense for every emplace
, otherwise I could do the grunt work. My usecase atm would only involve etl::variant
.
The C++03 compatible emplace
functions in the ETL are not really the same as those in C++11.
C++11's take 'universal' references, while those for C++03 must be a specific type.
They are also limited in the number of parameters, as every variation must be defined.
I think there was some misunderstanding, but that doesn't matter.
To come back to the issue:
Emplace could be changed have both const and non-const reference parameters.
I agree that this would solve my issue. Let me know if I can help.
I need to pass a non-const reference to my class on construction, but emplace takes arguments as
const &
. My guess is, theconst
doesn't need to be there.Works for C++11, so I guess it should also be ok for C++03. Godbolt