Unverified Commit 2da34f31 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Fix bug for Boost 1.58 (#1454)

* serialization: fix cast

* core: fix template default arguments

* serialization: fix make_nvp for when getting bool type

* serialization: fix pointer to pointee

* serialization: more fix

* serialization: try simpler fix

* algo: fix init of std::vector
parent 4509dbdd
Pipeline #14687 passed with stage
in 156 minutes and 54 seconds
......@@ -473,7 +473,7 @@ namespace pinocchio
GeometryModel & reduced_geom_model)
{
const std::vector<GeometryModel> temp_input_geoms { input_geom_model };
const std::vector<GeometryModel> temp_input_geoms(1,input_geom_model);
std::vector<GeometryModel> temp_reduced_geom_models;
buildReducedModel(input_model, temp_input_geoms, list_of_joints_to_lock,
......
......@@ -271,7 +271,7 @@ namespace pinocchio
typedef PINOCCHIO_ALIGNED_STD_VECTOR(JointModel) JointModelVector;
template<typename Scalar, int Options = 0, template<typename S, int O> class JointCollectionTpl, typename JointDataDerived>
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl, typename JointDataDerived>
bool operator==(const JointDataBase<JointDataDerived> & joint_data,
const JointDataTpl<Scalar,Options,JointCollectionTpl> & joint_data_generic)
{
......@@ -279,21 +279,21 @@ namespace pinocchio
}
template<typename Scalar, int Options = 0, template<typename S, int O> class JointCollectionTpl, typename JointDataDerived>
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl, typename JointDataDerived>
bool operator!=(const JointDataBase<JointDataDerived> & joint_data,
const JointDataTpl<Scalar,Options,JointCollectionTpl> & joint_data_generic)
{
return joint_data_generic != joint_data.derived();
}
template<typename Scalar, int Options = 0, template<typename S, int O> class JointCollectionTpl, typename JointModelDerived>
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl, typename JointModelDerived>
bool operator==(const JointModelBase<JointModelDerived> & joint_model,
const JointModelTpl<Scalar,Options,JointCollectionTpl> & joint_model_generic)
{
return joint_model_generic == joint_model.derived();
}
template<typename Scalar, int Options = 0, template<typename S, int O> class JointCollectionTpl, typename JointModelDerived>
template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl, typename JointModelDerived>
bool operator!=(const JointModelBase<JointModelDerived> & joint_model,
const JointModelTpl<Scalar,Options,JointCollectionTpl> & joint_model_generic)
{
......
......@@ -19,6 +19,7 @@ namespace boost
#if BOOST_VERSION / 100 % 1000 == 58
namespace fixme
{
......@@ -75,6 +76,10 @@ namespace boost
nvp(const nvp & rhs) :
std::pair<const char *, std::vector<T,Allocator> *>(rhs.first, rhs.second)
{}
typedef typename std::vector<T,Allocator>::const_iterator const_iterator;
typedef typename std::vector<T,Allocator>::iterator iterator;
public:
explicit nvp(const char * name_, std::vector<T,Allocator> & t) :
// note: added _ to suppress useless gcc warning
......@@ -102,7 +107,7 @@ namespace boost
ar << BOOST_SERIALIZATION_NVP(count);
if (!const_value().empty())
{
for(typename std::vector<T,Allocator>::const_iterator hint = const_value().begin();
for(const_iterator hint = const_value().begin();
hint != const_value().end(); ++hint)
{
ar & boost::serialization::make_nvp("item", *hint);
......@@ -118,7 +123,7 @@ namespace boost
std::size_t count;
ar >> BOOST_SERIALIZATION_NVP(count);
value().resize(count);
for(typename std::vector<T,Allocator>::iterator hint = value().begin();
for(iterator hint = value().begin();
hint != value().end(); ++hint)
{
ar >> boost::serialization::make_nvp("item", *hint);
......@@ -127,6 +132,75 @@ namespace boost
BOOST_SERIALIZATION_SPLIT_MEMBER()
};
template<typename Allocator>
struct nvp< std::vector<bool,Allocator> > :
public std::pair<const char *, std::vector<bool,Allocator> *>,
public wrapper_traits<const nvp< std::vector<bool,Allocator> > >
{
//private:
nvp(const nvp & rhs) :
std::pair<const char *, std::vector<bool,Allocator> *>(rhs.first, rhs.second)
{}
typedef typename std::vector<bool,Allocator>::const_iterator const_iterator;
typedef typename std::vector<bool,Allocator>::iterator iterator;
public:
explicit nvp(const char * name_, std::vector<bool,Allocator> & t) :
// note: added _ to suppress useless gcc warning
std::pair<const char *, std::vector<bool,Allocator> *>(name_, boost::addressof(t))
{}
const char * name() const {
return this->first;
}
std::vector<bool,Allocator> & value() const {
return *(this->second);
}
const std::vector<bool,Allocator> & const_value() const {
return *(this->second);
}
template<class Archive>
void save(Archive & ar,
const unsigned int /* file_version */
) const
{
const size_t count(const_value().size());
ar << BOOST_SERIALIZATION_NVP(count);
if (!const_value().empty())
{
for(const_iterator hint = const_value().begin();
hint != const_value().end(); ++hint)
{
bool v = *hint;
ar & boost::serialization::make_nvp("item", v);
}
}
}
template<class Archive>
void load(Archive & ar,
const unsigned int /* file_version */
)
{
std::size_t count;
ar >> BOOST_SERIALIZATION_NVP(count);
value().resize(count);
for(iterator hint = value().begin();
hint != value().end(); ++hint)
{
bool v;
ar >> boost::serialization::make_nvp("item", v);
*hint = v;
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment