-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formalize conversion with generic 'from'/'into' free functions #992
Labels
enhancement
New feature
Comments
20 tasks
elBoberido
added a commit
to ApexAI/iceoryx
that referenced
this issue
Dec 15, 2021
…nversions of enums and other types
20 tasks
elBoberido
added a commit
to ApexAI/iceoryx
that referenced
this issue
Dec 15, 2021
…nversions of enums and other types
elBoberido
added a commit
to ApexAI/iceoryx
that referenced
this issue
Jan 5, 2022
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido
added a commit
to ApexAI/iceoryx
that referenced
this issue
Jan 5, 2022
Signed-off-by: Mathias Kraus <mathias.kraus@apex.ai>
elBoberido
added a commit
to ApexAI/iceoryx
that referenced
this issue
Jan 6, 2022
elBoberido
added a commit
that referenced
this issue
Jan 10, 2022
…d-into-free-functions-for-conversion iox-#992 Add templated from/into free functions for conversions
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brief feature description
While the conversion operator can be implemented for classes, there is no such possibility for enums. To have a consistency in the code base there should be a convention on how to do it. The proposal presents
from
/into
free functions.Detailed information
Similar to the Rust
From
/Into
trait, there are templatedfrom
/into
free functions. A developer has to implement onlyfrom
andinto
will automatically be available.This is the implementation in
convert.hpp
The developer can then specialize the
from
free function for a given enumOn the caller side the developer can just use
auto barEnumValue = cxx::into<Bar>(Foo::Hypnotode);
The text was updated successfully, but these errors were encountered: