I have a C++ code, in which I have a class with a std::sharedptr to a RNG from random…
- User
I have a C++ code, in which I have a class with a std::shared_ptr to a RNG from random library. I am declaring it as a pointer because I need to pass it through different classes but I would initialize it only in the main class. A colleague is proposing to declaring it as const std::shared_ptrstd::mt19937, however it is not clear if there are pros or cons in this practice. Please provide feedback on it.
- Assistant
- User
In this case, is it meaningfull to provide as argument a const std::shared_ptrstd::mt19937& or it is more convenient to pass as argument std::shared_ptrstd::mt19937 (so not a const reference)?
- Assistant