While compiling the project in VS Studio 2022 I get following error:
error C2440: 'initializing': cannot convert from 'initializer list' to 'toppra::BoundaryCond'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\tests\test_cubic_spline.cpp(79,18): error C2440: 'initializing': cannot convert from 'initializer list' to 'toppra::BoundaryCond'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\tests\test_cubic_spline.cpp(79,18): message : 'toppra::BoundaryCond::BoundaryCond': ambiguous call to overloaded function
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\src\toppra/geometric_path/piecewise_poly_path.hpp(23,3): message : could be 'toppra::BoundaryCond::BoundaryCond(int,const toppra::Vector)'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\src\toppra/geometric_path/piecewise_poly_path.hpp(21,3): message : or 'toppra::BoundaryCond::BoundaryCond(int,const std::vector<toppra::value_type,std::allocator<toppra::value_type>> &)'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\tests\test_cubic_spline.cpp(79,18): message : while trying to match the argument list '(int, initializer list)'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\tests\test_cubic_spline.cpp(95,18): error C2440: 'initializing': cannot convert from 'initializer list' to 'toppra::BoundaryCond'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\tests\test_cubic_spline.cpp(95,18): message : 'toppra::BoundaryCond::BoundaryCond': ambiguous call to overloaded function
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\src\toppra/geometric_path/piecewise_poly_path.hpp(23,3): message : could be 'toppra::BoundaryCond::BoundaryCond(int,const toppra::Vector)'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\src\toppra/geometric_path/piecewise_poly_path.hpp(21,3): message : or 'toppra::BoundaryCond::BoundaryCond(int,const std::vector<toppra::value_type,std::allocator<toppra::value_type>> &)'
5>C:\Users\Default\git\ToppRaMinimal\toppra\toppra\cpp\tests\test_cubic_spline.cpp(95,18): message : while trying to match the argument list '(int, initializer list)'
...
The compiler does not know which constructor to use when calling e.g. BoundaryCond bc{1, {0, 0, 0, 0, 0, 0}};.
I think this is because std::vector and toppra::Vector both support initializer lists so the compiler cannot decide which type it has to use.
Solution: Explicitly declare std::vector<value_type> before the initializer list in the constructor call like this: BoundaryCond{3, std::vector<value_type>{1.52, 7.21, 9.31, 2.52, 4.41, 5.54}}
While compiling the project in VS Studio 2022 I get following error:
error C2440: 'initializing': cannot convert from 'initializer list' to 'toppra::BoundaryCond'
In
piecewise_poly_path.hpp
we have:The compiler does not know which constructor to use when calling e.g.
BoundaryCond bc{1, {0, 0, 0, 0, 0, 0}};
. I think this is becausestd::vector
andtoppra::Vector
both support initializer lists so the compiler cannot decide which type it has to use.Solution: Explicitly declare
std::vector<value_type>
before the initializer list in the constructor call like this:BoundaryCond{3, std::vector<value_type>{1.52, 7.21, 9.31, 2.52, 4.41, 5.54}}