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

Addressing the limitation of get_name #152

Merged
merged 4 commits into from
Jan 28, 2024
Merged

Conversation

schaumb
Copy link

@schaumb schaumb commented Nov 30, 2023

resolves #151

@schaumb
Copy link
Author

schaumb commented Nov 30, 2023

I found another way to work "fake object" without requiring C++20 (template variable):

template<class T>
struct X {
   const T value;
   static const X<T> report_if_you_see_link_error_with_this_object; // this is not defined, only declared. equivalent with template varaible
};

template <class T>
constexpr const T& fake_object() noexcept {
    return X<T>::report_if_you_see_link_error_with_this_object.value;
}

This is equivalent to prf::detail::unsafe_declval without the nullptr dereference hack.

I created already the changes. Can I try to apply these modifications too?

What do you think @denzor200 ?

@apolukhin apolukhin merged commit 4c15f21 into boostorg:develop Jan 28, 2024
1 check passed
@apolukhin
Copy link
Member

Looks very good!

Many thanks for the PR!

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.

Addressing the limitation of get_name (non-internal linkage)
2 participants