![](/img/trans.png)
[英]Why would an Alias Template be treated differently than the aliased type template when it comes to friendship?
[英]Casting an alias template to the aliased type
考慮以下代碼:
struct foo {/* stuff */};
template <typename T>
using bar = foo;
// Elsewhere
bar<int> A;
auto &B = static_cast<foo&>(A);
使用B
合法嗎?
是的。 對於任何T
bar<T>
與foo
類型完全相同。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.