2014-10-19 47 views

回答

1

對於元組的情況下(基於DYP的評論主編):

template <typename... Ts> 
std::tuple<Ts...> remove_tuple_ref(std::tuple<Ts&...> x) 
{ 
    return {x}; 
} 
+0

那麼你不需要型特質更多...但這一招要求所有元組類型的引用。 – dyp 2014-10-19 02:54:17

+0

@dyp我以前的編輯是不是處理所有的元組類型都是引用? – 0x499602D2 2014-10-19 02:55:43

+0

您的原始版本可能會擴展以處理非參考元組元素。 (正如壓縮版本'template std :: tuple ...> remove_tuple_ref(std :: tuple x){return {x};}') – dyp 2014-10-19 02:57:00

相關問題