Skip to content
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

change from_string to take pointer, return void #24

Merged
merged 1 commit into from
May 24, 2024

Conversation

mgates3
Copy link
Collaborator

@mgates3 mgates3 commented May 24, 2024

We can't overload on the return type, so we consider 3 options.

  1. Use template argument. This forces from_string to always be injected into one namespace, e.g., testsweeper, which isn't great.
    Uplo uplo = testsweeper::from_string<Uplo>( "Lower" );
  1. Use dummy argument to specify the return type. Uses ADL. This is a bit unintuitive.
    Uplo uplo = from_string( "Lower", Uplo() );
  1. Pass value by pointer and update it. Uses ADL. This requires declaring a variable, so it isn't quite as convenient, but it seems more intuitive.
    Uplo uplo;
    from_string( "Lower", &uplo );

This PR changes from option 2 to option 3.

Also adds some tests for the has_to_string and has_from_string introspection tests.

@mgates3 mgates3 merged commit 46266db into icl-utk-edu:master May 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant