【错误记录/boost】error: static assertion failed: boost::variant does not contain specified type U, call t

错误详情

In file included from /usr/local/include/boost/iterator/iterator_categories.hpp:22,
                 from /usr/local/include/boost/iterator/iterator_facade.hpp:14,
                 from /usr/local/include/boost/filesystem/path.hpp:28,
                 from /usr/local/include/boost/filesystem.hpp:16,
                 from /home/pi/model/include/model_output_labels_loader.hpp:7,
                 from /home/pi/model/mob.cpp:5:
/usr/local/include/boost/variant/get.hpp: In instantiation of ‘typename boost::add_reference::type boost::strict_get(boost::variant&) [with U = std::vector; T0 = std::vector; TN = {}; typename boost::add_reference::type = std::vector&]’:
/usr/local/include/boost/variant/get.hpp:292:25:   required from ‘typename boost::add_reference::type boost::get(boost::variant&) [with U = std::vector; T0 = std::vector; TN = {}; typename boost::add_reference::type = std::vector&]’
/home/pi/model/mob.cpp:114:91:   required from here
/usr/local/include/boost/variant/get.hpp:220:5: error: static assertion failed: boost::variant does not contain specified type U, call to boost::get(boost::variant&) will always throw boost::bad_get exception
  220 |     BOOST_STATIC_ASSERT_MSG(
      |     ^~~~~~~~~~~~~~~~~~~~~~~

解决方案

  • here
  • 即添加定义
    #define BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT
    

你可能感兴趣的:(错误记录)