2015-09-28 89 views
0

我嘗試搜索std :: ignore的可能實現,但未能找到明確的答案。std :: ignore的可能實現

http://mail-archives.apache.org/mod_mbox/stdcxx-dev/200807.mbox/%[email protected]%3E引用與C++規範問題,並提供和說明執行情況

namespace std { 

struct _Ignore 
{ 
    template <class _Type> 
    _Ignore& operator= (const _Type& value) { return *this; } 
}; 

const _Ignore ignore = _Ignore(); 

} // namespace std 

而且也有對問題進行進一步的討論。那麼,當前的實現是怎樣的呢?爲什麼?

+0

什麼是不清楚,這是什麼問題? –

+0

採取選擇的實施,並看看他們做了什麼。 – nwp

回答

1

在海灣合作委員會它看起來像你發佈的東西除了ignore不是const。這克服了你所鏈接的主題中的主要異議。

在Clang中,賦值運算符是const,並且還返回const,並且整個類本身就是一個模板(除了賦值運算符是模板之外)。出於任何原因,模板實例化使用unsigned char

相關問題