Initialize std::vector of filters::FilterChain in class constructor

asked 2019-03-21 09:59:02 -0500

dhindhimathai gravatar image

I would like to be able to use a std::vector<filters::FilterChain<double>> in my class. Having defined std::vector<filters::FilterChain<double>> vector_filters in my class header as private variable, how do I initialize this in my class constructor?

The problem is that ROS's filters::FilterChain<double> does not have a default constructor.

Thank you so much in advance.

edit retag flag offensive close merge delete


Use std::shared_ptr?

gvdhoorn gravatar image gvdhoorn  ( 2019-03-21 10:04:45 -0500 )edit

@gvdhoorn You mean using std::shared_ptr<std::vector<filters::FilterChain<double>>> vector_filters;?

dhindhimathai gravatar image dhindhimathai  ( 2019-03-21 10:17:30 -0500 )edit

No. Make a vector of std::shared_ptr of filters.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-21 10:54:57 -0500 )edit