title: create a queue with multiple data types
body: <p>I want to be able to have a queue class that can accept &quot;any&quot; preferred data type wether that is a CURL type or just a std::string type. Queue of strings or queue of curl handles if you will.</p>
  <pre><code>#pragma once
  
  #include &lt;iostream&gt;
  #include &lt;queue&gt;
  #include &lt;string&gt;
  #include &lt;mutex&gt;
  #include &lt;condition_variable&gt;
  #include &lt;chrono&gt;
  
  #include &quot;queue_safe.h&quot;
  
  void SafeQueue::initialize() {
  
      /* initialize a std::queue */
  
      safe_queue = {};
      
  }
  
  std::string SafeQueue::get() {
  
      std::unique_lock&lt;std::mutex&gt; condition_lock(queue_lock);
  
      if (safe_queue.empty()) {
  
          if (ready.wait_for(condition_lock, std::chrono::seconds(20)) == std::cv_status::timeout) {
  
              /* timeout was reached, no items left */
  
              return std::string();
          }
  
          /* if a timeout was not hit, but the queue was empty previously this will execute */
  
          std::string element = safe_queue.front();
  
          safe_queue.pop();
  
          return element;
  
          
      }
  
      else {
  
          /* not empty, return an element */
  
          std::string element = safe_queue.front();
  
          safe_queue.pop();
  
          return element;
      }
  
      /* do not need a return value here since empty HAS to be either true/false */
  
  }
  
  void SafeQueue::put(std::string&amp; element) {
  
      std::lock_guard&lt;std::mutex&gt; put_guard(queue_lock);
  
      safe_queue.push(element);
  
      ready.notify_one();
  
  }
  
  uint8_t SafeQueue::empty() {
  
      std::lock_guard&lt;std::mutex&gt; empty_guard(queue_lock);
      
      if (safe_queue.size() == 0) {
  
          return 1;
      }
  
      return 0;
  
  }
  
  </code></pre>
  <p>queue.cpp</p>
  <pre><code>#pragma once
  
  #include &lt;string&gt;
  #include &lt;mutex&gt;
  #include &lt;queue&gt;
  #include &lt;condition_variable&gt;
  
  class SafeQueue {
  public:
      std::condition_variable ready;
      std::mutex queue_lock;
  
      std::queue&lt;std::string&gt; safe_queue;
      uint8_t empty();
      void initialize();
      void put(std::string&amp; element);
      std::string get();
  };
  </code></pre>
  <p>queue.h
  This works fine for a single type (string). But how could i adapt it to allow any wanted type like mentioned above?</p>