vendredi 28 août 2020

How to pass array of shared pointer to other function in c++ [duplicate]

I'd like to pass an array of shared pointer to another class.

How to use a function parameter for it?

Below is example.

// < BaseClass >
 std::shared_pointer<queue> queue_[3];

// init 0,1,2
 queue[0] = std::make_shared<queue>

// move queue to inner class
 InnerClass.init(queue)
<InnberClass>
    // I don't know how to use func param
    // this is normal usage to pass shared pointer
    init(const std::shared_pointer<queue>& queue)
    {
      queue_ = queue;
    }
    // array of share pointer(const ref) to func
    init(const ?& queue)
    {
    queue_array_ = queue;
    }

Aucun commentaire:

Enregistrer un commentaire