Remove boost dependency from folly/ProducerConsumerQueue.h
authorBruno Goncalves <bruno.slackware@gmail.com>
Sat, 17 Oct 2015 02:03:22 +0000 (19:03 -0700)
committerfacebook-github-bot-9 <folly-bot@fb.com>
Sat, 17 Oct 2015 02:20:27 +0000 (19:20 -0700)
Summary: Boost is great, but c++11 incorporate some of their stuffs, and classes like ProducerConsumerQueue don't need it anymore.
Closes https://github.com/facebook/folly/pull/321

Reviewed By: fredemmott, yfeldblum

Differential Revision: D2519081

fb-gh-sync-id: b138a5af4662d1e7ef5e0823cf4001880ee02456

folly/ProducerConsumerQueue.h

index 7d2c05bf43c8beb930e7285680c61c76aabef517..fedc2c7429c8467b779332702b3631e61efe8d83 100644 (file)
@@ -26,8 +26,6 @@
 #include <stdexcept>
 #include <type_traits>
 #include <utility>
-#include <boost/noncopyable.hpp>
-#include <boost/type_traits.hpp>
 
 namespace folly {
 
@@ -36,9 +34,12 @@ namespace folly {
  * without locks.
  */
 template<class T>
-struct ProducerConsumerQueue : private boost::noncopyable {
+struct ProducerConsumerQueue {
   typedef T value_type;
 
+  ProducerConsumerQueue(const ProducerConsumerQueue&) = delete;
+  ProducerConsumerQueue& operator = (const ProducerConsumerQueue&) = delete;
+
   // size must be >= 2.
   //
   // Also, note that the number of usable slots in the queue at any
@@ -60,7 +61,7 @@ struct ProducerConsumerQueue : private boost::noncopyable {
     // We need to destruct anything that may still exist in our queue.
     // (No real synchronization needed at destructor time: only one
     // thread can be doing this.)
-    if (!boost::has_trivial_destructor<T>::value) {
+    if (!std::is_trivially_destructible<T>::value) {
       size_t read = readIndex_;
       size_t end = writeIndex_;
       while (read != end) {