c++ question template<class ...Args>
https://github.com/facebook/folly/blob/master/folly/ProducerConsumerQueue.hI read the source code and I do not understand
template<class ...Args>
bool write(Args&&... recordArgs) {
in this function
template<class ...Args>
bool write(Args&&... recordArgs) {
auto const currentWrite = writeIndex_.load(std::memory_order_relaxed);
auto nextRecord = currentWrite + 1;
if (nextRecord == size_) {
nextRecord = 0;
}
if (nextRecord != readIndex_.load(std::memory_order_acquire)) {
new (&records_) T(std::forward<Args>(recordArgs)...);
writeIndex_.store(nextRecord, std::memory_order_release);
return true;
}
// queue is full
return false;
}
TIA http://www.cplusplus.com/articles/EhvU7k9E/
it's a new feature of C++ 11 艾瑞克 发表于 24-6-2016 10:51
http://www.cplusplus.com/articles/EhvU7k9E/
it's a new feature of C++ 11
Thanks:good Vairadic template
页:
[1]