Я пытаюсь скомпилировать код на C++, а ниже - фрагмент кода, я добавил ошибку ниже этого фрагмента кода.Недопустимая ошибка конструктора в C++
// Move constructor
CLM(const CLM&& other)
{
this->detection_success = other.detection_success;
this->tracking_initialised = other.tracking_initialised;
this->detection_certainty = other.detection_certainty;
this->model_likelihood = other.model_likelihood;
this->failures_in_a_row = other.failures_in_a_row;
pdm = other.pdm;
params_local = other.params_local;
params_global = other.params_global;
detected_landmarks = other.detected_landmarks;
landmark_likelihoods = other.landmark_likelihoods;
patch_experts = other.patch_experts;
landmark_validator = other.landmark_validator;
triangulations = other.triangulations;
kde_resp_precalc = other.kde_resp_precalc;
}
// Assignment operator for rvalues
CLM & operator= (const CLM&& other)
{
this->detection_success = other.detection_success;
this->tracking_initialised = other.tracking_initialised;
this->detection_certainty = other.detection_certainty;
this->model_likelihood = other.model_likelihood;
this->failures_in_a_row = other.failures_in_a_row;
pdm = other.pdm;
params_local = other.params_local;
params_global = other.params_global;
detected_landmarks = other.detected_landmarks;
landmark_likelihoods = other.landmark_likelihoods;
patch_experts = other.patch_experts;
landmark_validator = other.landmark_validator;
triangulations = other.triangulations;
kde_resp_precalc = other.kde_resp_precalc;
return *this;
}
Я получаю ошибку ниже:
In file included from ../../Demo/Pack/CLM/include/CLM_utils.h:9:0,
from ../../Demo/Pack/CLM/src/CCNF_patch_expert.cpp:3:
../../Demo/Pack/CLM/include/CLM.h:170:16: error: expected ‘,’ or ‘...’ before ‘&&’ token
CLM(const CLM&& other)
^
../../Demo/Pack/CLM/include/CLM.h:170:24: error: invalid constructor; you probably meant ‘CLMTracker::CLM (const CLMTracker::CLM&)’
CLM(const CLM&& other)
^
../../Demo/Pack/CLM/include/CLM.h:192:28: error: expected ‘,’ or ‘...’ before ‘&&’ token
CLM & operator= (const CLM&& other)
^
../../Demo/Pack/CLM/include/CLM.h: In member function ‘CLMTracker::CLM& CLMTracker::CLM::operator=(CLMTracker::CLM)’:
../../Demo/Pack/CLM/include/CLM.h:194:29: error: ‘other’ was not declared in this scope
this->detection_success = other.detection_success;
Я не знаю, что случилось с кодом и, что означает ошибка? Может кто-нибудь, пожалуйста, помогите.
Кажется, что ваш компилятор не поддерживает C++ 11. –
1) Вы скомпилировали с поддержкой C++ 11? 2) ссылки на константы довольно бессмысленны. –
Несвязанный: традиционный TLA CLM заставил меня улыбнуться, я должен признать. – WhozCraig