Discussion:
The access for a member class template in the deduction guide.
(too old to reply)
'Vlad from Moscow' via ISO C++ Standard - Discussion
2018-10-17 14:17:29 UTC
Permalink
In the section 17.10 Deduction guides there is written (p.#3)

...A deduction-guide shall be declared in the same scope as the
corresponding class template and, for a member class template, *with the
same access*....
It is not clear whar access is meant. Does it mean that a deduction guide
can be declared in a class scope?
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Casey Carter
2018-10-17 15:30:50 UTC
Permalink
Yes, a deduction guide for a nested class template can be declared at class
scope:

template<class T> struct X {
template<class U> struct Y {
template<class V> Y(V) {}
};

template<class W> Y(W) -> Y<W>;
};

int main() {
X<int>::Y{42}; // deduces X<int>::Y<int>
}


Per C++17 [class.mem], deduction-guide is one of the allowed replacements
for member-declaration in the grammar. (Although GCC apparently didn't get
the memo: https://godbolt.org/z/aJcWfr.)
Post by 'Vlad from Moscow' via ISO C++ Standard - Discussion
In the section 17.10 Deduction guides there is written (p.#3)
...A deduction-guide shall be declared in the same scope as the
corresponding class template and, for a member class template, *with the
same access*....
It is not clear whar access is meant. Does it mean that a deduction guide
can be declared in a class scope?
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Casey Carter
2018-10-17 15:35:38 UTC
Permalink
Post by Casey Carter
Yes, a deduction guide for a nested class template can be declared at
template<class T> struct X {
template<class U> struct Y {
template<class V> Y(V) {}
};
template<class W> Y(W) -> Y<W>;
};
int main() {
X<int>::Y{42}; // deduces X<int>::Y<int>
}
Per C++17 [class.mem], deduction-guide is one of the allowed replacements
for member-declaration in the grammar. (Although GCC apparently didn't get
the memo: https://godbolt.org/z/aJcWfr.)
This is GCC PR 79501 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79501).
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
'Vlad from Moscow' via ISO C++ Standard - Discussion
2018-10-18 15:51:09 UTC
Permalink
Then sjould the bolded word *access* be appended with the word *control in
the quote*?
Post by Casey Carter
Post by Casey Carter
Yes, a deduction guide for a nested class template can be declared at
template<class T> struct X {
template<class U> struct Y {
template<class V> Y(V) {}
};
template<class W> Y(W) -> Y<W>;
};
int main() {
X<int>::Y{42}; // deduces X<int>::Y<int>
}
Per C++17 [class.mem], deduction-guide is one of the allowed replacements
for member-declaration in the grammar. (Although GCC apparently didn't get
the memo: https://godbolt.org/z/aJcWfr.)
This is GCC PR 79501 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79501).
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Continue reading on narkive:
Loading...