Здравствуйте, OnetimeAnon, Вы писали:
OA>Добрый вечер!
OA>Не получается скомпилировать следующий код (MSVC 2010), написанный по образцу из официальных источников (Boost 1.49.0): OA>
OA>Падает BOOST_RANGE_CONCEPT_ASSERT в нескольких местах.
OA>Как преодолеть эту неприятность, не забуриваясь в недры Буста?
Забурись в недры буста и найди место где не компилится. Там скорее всего есть комментарий который говорит, почему хдесь не компилится.
И вывод компилятора не забывай добавлять.
Здесь типы по ошибке разные, но это не принципиально.
OA>>Падает BOOST_RANGE_CONCEPT_ASSERT в нескольких местах. OA>>Как преодолеть эту неприятность, не забуриваясь в недры Буста? K>Забурись в недры буста и найди место где не компилится. Там скорее всего есть комментарий который говорит, почему хдесь не компилится.
Ругается, видимо, на то, что массив не удовлетворяет концепту range'а. Но согласно документации, достаточно использовать их адаптер:
Здравствуйте, Kernan, Вы писали:
K>Забурись в недры буста и найди место где не компилится. Там скорее всего есть комментарий который говорит, почему хдесь не компилится.
Комментария нет.
K>И вывод компилятора не забывай добавлять.
Вот упрощённая версия кода, который не компилируется:
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
int main(int argc, char const* argv[])
{
typedef boost::geometry::model::d2::point_xy<double> point_2d;
typedef boost::geometry::model::polygon<point_2d> polygon_2d;
polygon_2d p;
double const area = boost::geometry::area(p); // Без этой строки всё ок.return 0;
}
Первая ошибка компиляции:
1>d:\boost_1_49_0\boost\range\concepts.hpp(140): error C2146: syntax error : missing ',' before identifier 'traversal_category'
1> d:\boost_1_49_0\boost\concept\detail\has_constraints.hpp(42) : see reference to class template instantiation 'boost::range_detail::SinglePassIteratorConcept<Iterator>' being compiled
1> with
1> [
1> Iterator=std::_Vector_iterator<std::_Vector_val<point_2d,std::allocator<point_2d>>>
1> ]
1> d:\boost_1_49_0\boost\concept\detail\msvc.hpp(53) : see reference to class template instantiation 'boost::concepts::not_satisfied<Model>' being compiled
1> with
1> [
1> Model=boost::range_detail::SinglePassIteratorConcept<std::_Vector_iterator<std::_Vector_val<point_2d,std::allocator<point_2d>>>>
1> ]
1> d:\boost_1_49_0\boost\range\concepts.hpp(259) : see reference to class template instantiation 'boost::concepts::require<Model>' being compiled
1> with
1> [
1> Model=boost::range_detail::SinglePassIteratorConcept<std::_Vector_iterator<std::_Vector_val<point_2d,std::allocator<point_2d>>>>
1> ]
1> d:\boost_1_49_0\boost\range\concepts.hpp(297) : see reference to class template instantiation 'boost::SinglePassRangeConcept<T>' being compiled
1> with
1> [
1> T=boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>
1> ]
1> d:\boost_1_49_0\boost\range\concepts.hpp(331) : see reference to class template instantiation 'boost::ForwardRangeConcept<T>' being compiled
1> with
1> [
1> T=boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>
1> ]
1> d:\boost_1_49_0\boost\range\concepts.hpp(349) : see reference to class template instantiation 'boost::BidirectionalRangeConcept<T>' being compiled
1> with
1> [
1> T=boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>
1> ]
1> d:\boost_1_49_0\boost\concept\detail\has_constraints.hpp(42) : see reference to class template instantiation 'boost::RandomAccessRangeConcept<T>' being compiled
1> with
1> [
1> T=boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>
1> ]
1> d:\boost_1_49_0\boost\concept\detail\msvc.hpp(53) : see reference to class template instantiation 'boost::concepts::not_satisfied<Model>' being compiled
1> with
1> [
1> Model=boost::RandomAccessRangeConcept<boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>>
1> ]
1> d:\boost_1_49_0\boost\geometry\geometries\concepts\ring_concept.hpp(85) : see reference to class template instantiation 'boost::concepts::require<Model>' being compiled
1> with
1> [
1> Model=boost::RandomAccessRangeConcept<boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>>
1> ]
1> d:\boost_1_49_0\boost\concept\detail\has_constraints.hpp(42) : see reference to class template instantiation 'boost::geometry::concept::ConstRing<Geometry>' being compiled
1> with
1> [
1> Geometry=boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>
1> ]
1> d:\boost_1_49_0\boost\concept\detail\msvc.hpp(53) : see reference to class template instantiation 'boost::concepts::not_satisfied<Model>' being compiled
1> with
1> [
1> Model=boost::geometry::concept::ConstRing<boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>>
1> ]
1> d:\boost_1_49_0\boost\geometry\geometries\concepts\polygon_concept.hpp(105) : see reference to class template instantiation 'boost::concepts::require<Model>' being compiled
1> with
1> [
1> Model=boost::geometry::concept::ConstRing<boost::geometry::model::ring<point_2d,true,true,std::vector,std::allocator>>
1> ]
1> d:\boost_1_49_0\boost\concept\detail\has_constraints.hpp(42) : see reference to class template instantiation 'boost::geometry::concept::ConstPolygon<PolygonType>' being compiled
1> with
1> [
1> PolygonType=const polygon_2d
1> ]
1> d:\boost_1_49_0\boost\concept\detail\msvc.hpp(53) : see reference to class template instantiation 'boost::concepts::not_satisfied<Model>' being compiled
1> with
1> [
1> Model=boost::geometry::concept::ConstPolygon<const polygon_2d>
1> ]
1> d:\boost_1_49_0\boost\geometry\geometries\concepts\check.hpp(44) : see reference to class template instantiation 'boost::concepts::require<Model>' being compiled
1> with
1> [
1> Model=boost::geometry::concept::ConstPolygon<const polygon_2d>
1> ]
1> d:\boost_1_49_0\boost\geometry\geometries\concepts\check.hpp(88) : see reference to class template instantiation 'boost::geometry::detail::concept_check::check<Concept>' being compiled
1> with
1> [
1> Concept=boost::geometry::concept::ConstPolygon<const polygon_2d>
1> ]
1> d:\boost_1_49_0\boost\geometry\geometries\concepts\check.hpp(132) : see reference to class template instantiation 'boost::geometry::dispatch::check<GeometryTag,Geometry,IsConst>' being compiled
1> with
1> [
1> GeometryTag=boost::geometry::polygon_tag,
1> Geometry=const polygon_2d,
1> IsConst=true
1> ]
1> d:\boost_1_49_0\boost\geometry\geometries\concepts\check.hpp(146) : see reference to class template instantiation 'boost::geometry::concept::detail::checker<Geometry,IsConst>' being compiled
1> with
1> [
1> Geometry=const polygon_2d,
1> IsConst=true
1> ]
1> d:\boost_1_49_0\boost\geometry\algorithms\area.hpp(235) : see reference to function template instantiation 'void boost::geometry::concept::check<const Geometry>(void)' being compiled
1> with
1> [
1> Geometry=polygon_2d
1> ]
1> d:\cppsandbox\cppsandbox.cpp(11) : see reference to function template instantiation 'double boost::geometry::area<polygon_2d>(const Geometry &)' being compiled
1> with
1> [
1> Geometry=polygon_2d
1> ]
Здравствуйте, OnetimeAnon, Вы писали:
OA>Здравствуйте, Ops, Вы писали:
Ops>>Language extensions проверь в настройках проекта/файла, должны быть включены.
OA>Эпический провал. OA>А что это за расширения? Насколько это переносимо? Мне код потом ещё на XCode собирать.
Нормально все перенесется, я думаю. Буст просто считает, что если собирается в студии, то можно использовать фичи по полной. С другим компилятором будет другой код, ну или такой же, если он поддерживает.
Ops>>ЗЫ. Решение найдено гуглом за 3 клика.
OA>По какому хоть запросу?
Да часть первой строчки из ошибки, нашел схожий баг в рассылке буста, и там же решение, попробовал скомпилировать и так и так — оно.
Ну и ошибку перед тем, как строчку выбрать, просмотрел глазами