std::optional<T> call by reference
问题 I am implementing the following function: bool DenStream::_try_merge(const double sample, const double weight, const std::optional<MicroCluster>& micro_cluster) const { if (micro_cluster) { MicroCluster micro_cluster_copy(*micro_cluster); micro_cluster_copy.insert_sample(sample, weight); if (micro_cluster_copy.get_radius() <= this->eps) { micro_cluster.insert_sample(sample, weight); // THIS DOES NOT WORK return true; } } return false; }; The compiler says error: 'const class std::optional'