jeudi 28 septembre 2017

c++11 std::thread return from getter

I am trying to do the following

#pragma once
#ifndef PRODUCER_H
#define PRODUCER_H

#include <thread>

class Producer
{
private:
   std::thread producer_thread;
public:
   Producer();
   std::thread get_producer(void)
   {
      return producer_thread;
   }
};


#endif

The error in Visual Studio is that producer_thread can't be accessed because it is a deleted function?

Aucun commentaire:

Enregistrer un commentaire