The program runs normally under the Linux
system, and now the following error occurs when using VS2015
on the Windows7
system
note: see declaration of 'ncorr::details::base_region<T_container>::operator ='
note: definition
note: 'std::enable_ifstd::is_same<container_traits<T_container2::nonconst_container,base_region<T_container>::nonconst_container>::value,ncorr::details::base_region<T_container>&>::type ncorr::details::base_region<T_container>::operator =(const ncorr::details::base_region<T_container> &)'
note: existing declarations
note: 'ncorr::details::base_region<T_container> &ncorr::details::base_region<T_container>::operator =(container_traits<T_container>::const_reference)'
note: 'ncorr::details::base_region<T_container> &ncorr::details::base_region<T_container>::operator =(container_traits<T_container>::const_container &)'
etc
I feel that this is usually a problem with VS2015
, and certain C++ syntaxes are somewhat different on VS2015
. Below is the code part, thanks for telling me the improvement part
// Base Region -----------------------------------------------------------//
template <typename T_container>
base_region<T_container>& base_region<T_container>::operator=(const base_region ®) {
if (this->region_h != reg.region_h || this->region_w != reg.region_w) {
throw std::invalid_argument("Attempted to assign region of size: " + reg.region_size_2D_string() +
" to region of size: " + region_size_2D_string() + ".");
}
std::copy(reg.begin(), reg.end(), this->begin());
return *this;
}
template <typename T_container>
template <typename T_container2>
typename std::enable_if<std::is_same<typename container_traits<T_container2>::nonconst_container, typename base_region<T_container>::nonconst_container>::value, base_region<T_container>&>::type base_region<T_container>::operator=(const base_region<T_container2> ®) {
if (this->region_h != reg.region_h || this->region_w != reg.region_w) {
throw std::invalid_argument("Attempted to assign region of size: " + reg.region_size_2D_string() +
" to region of size: " + region_size_2D_string() + ".");
}
std::copy(reg.begin(), reg.end(), this->begin());
return *this;
}