Quantcast
Channel: C++14 Variable Templates: what is their purpose? Any usage example? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by Tiger Hwang for C++14 Variable Templates: what is their purpose? Any usage example?

$
0
0

I have a use case here.

template<typename CT> constexpr CT MARK = '%';template<> constexpr wchar_t MARK<wchar_t> = L'%';

which are used in a string processing template.`

template <typename CT> void ProcessString(const std::basic_string<CT>& str){    auto&& markpos = str.find(MARK<CT>);    ...}

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>