Salut J'ai quelques boost :: multi_array défini comme ci-dessous:C++: Comment avoir un tableau de boost :: multi_array
typedef boost::multi_array<double, 3> region_prior_integral_image
Je suis en train de créer un tableau de region_prior_integral_image
comme ce qui suit:
unordered_map<string, int> filename_to_hash_key_map = get_filename_to_hash_key_map();
unordered_map<string, region_prior_integral_image> filename_to_region_prior_map = get_region_prior_integral_images();
region_prior_integral_image* image_cache = new region_prior_integral_image[5];
for(unordered_map<string, int>::iterator it = filename_to_hash_key_map.begin(); it != filename_to_hash_key_map.end(); it++){
image_cache[it->second] = filename_to_region_prior_map[it->first];
}
Toutefois, le programme se termine par ce qui suit: SemanticTextonForest: /home/aly/libs/boost_1_51_0/stage/include/boost/multi_array/multi_array_ref.hpp:488: boost::multi_array_ref<T, NumDims>& boost::multi_array_ref<T, NumDims>::operator=(const ConstMultiArray&) [with ConstMultiArray = boost::multi_array<double, 3ul>, T = double, long unsigned int NumDims = 3ul, boost::multi_array_ref<T, NumDims> = boost::multi_array_ref<double, 3ul>]: Assertion
std :: égal (other.shape(), other.shape() + this-> num_dimensions(), this-> forme()) » failed.`
Et Je ne sais pas pourquoi?
Je sais que je pouvais utiliser un vecteur, mais pour l'amour arguments permet de dire que je voulais avoir un tableau de region_prior_integral_images
Merci
une idée de comment obtenir les dimensions d'une image_prior_fr déjà créée? – Aly
Utiliser 'const size_type * \t \t shape() const;' comme: 'auto s = A.shape();', alors vous pouvez y accéder par 's [0]', 's [1]' et 's [2] 'dans votre cas. Il vaut mieux lire la référence officielle: http://www.boost.org/doc/libs/1_52_0/libs/multi_array/doc/reference.html –
Comment créer le tableau de region_prior_images d'une taille donnée? – Aly