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
tagged<user-defined type> does not work #364
Labels
Comments
CaseyCarter
changed the title
tagged must find get by ADL
tagged<user-defined type> does not work
Mar 5, 2017
SUPERSEDED(This PR also resolves #418.) Modify [taggedtup.tagged]/4 as follows: A tagged getter class with DerivedCharacteristic D, ElementIndex N, and ElementName "name" shall
provide the following interface:
struct __TAGGED_GETTER {
- constexpr decltype(auto) name() & { return get<N>(static_cast<D&>(*this)); }
+ constexpr decltype(auto) name() &
+ noexcept(noexcept(ADL::GET<N>(static_cast<D&>(*this))))
+ {
+ return ADL::GET<N>(static_cast<D&>(*this));
+ }
- constexpr decltype(auto) name() const & { return get<N>(static_cast<const D&>(*this)); }
+ constexpr decltype(auto) name() const &
+ noexcept(noexcept(ADL::GET<N>(static_cast<const D&>(*this))))
+ {
+ return ADL::GET<N>(static_cast<const D&>(*this));
+ }
- constexpr decltype(auto) name() && { return get<N>(static_cast<D&&>(*this)); }
+ constexpr decltype(auto) name() &&
+ noexcept(noexcept(ADL::GET<N>(static_cast<D&&>(*this))))
+ {
+ return ADL::GET<N>(static_cast<D&&>(*this));
+ }
+ constexpr decltype(auto) name() const &&
+ noexcept(noexcept(ADL::GET<N>(static_cast<const D&&>(*this))))
+ {
+ return ADL::GET<N>(static_cast<const D&&>(*this));
+ }
};
+Where ADL::GET refers to the exposition-only function template defined in an
+exposition-only sub-namespace:
+
+ namespace ADL {
+ using std::get;
+
+ template<size_t I, class T>
+ constexpr decltype(auto) GET(T&& t)
+ noexcept(noexcept(get<N>(std::forward<T>(t))))
+ {
+ return get<N>(std::forward<T>(t));
+ }
+ } Also strike the redundant and now incorrect example [alg.tagspec]/3: -3 [Example: tag::in is a type such that TAGGET(D, tag::in, N) names a type [...] |
Looks good. |
CaseyCarter
added a commit
to CaseyCarter/cmcstl2
that referenced
this issue
Jul 1, 2017
* Implement ericniebler/stl2#363 * Implement ericniebler/stl2#364 * Implement ericniebler/stl2#418
CaseyCarter
added a commit
to CaseyCarter/cmcstl2
that referenced
this issue
Jul 1, 2017
* Implement ericniebler/stl2#363 * Implement ericniebler/stl2#364 * Implement ericniebler/stl2#418
CaseyCarter
added a commit
to CaseyCarter/cmcstl2
that referenced
this issue
Jul 2, 2017
* Implement ericniebler/stl2#299 * Implement ericniebler/stl2#363 * Implement ericniebler/stl2#364 * Implement ericniebler/stl2#418 * Remove tuple_find that was dropped from variant ages ago * Implement extension 'structible object concepts * tighten up constrains in the tagged impl
LEWG has killed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since tagged getters use qualified
std::get
to access the fields ofBase
and users are forbidden to overloadstd::get
. A possible solution is to use ADL to findget
function templates in the user's namespace(s) as implemented in range-v3'stagged
.Proposed Resolution
This issue is resolved by the PR for #363.
The text was updated successfully, but these errors were encountered: