ros参数服务器初始化-param

问题:如下参数类型T,必须是常用的标准类型,不能使用重定义的数据类型。特别是整型,只能使用int,不能使用unsigned int等。

  template<typename T>
  T param(const std::string& param_name, const T& default_val)

 否则会报错:

error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’

这种错误通常是说“非const参数引用,不能引用临时变量”。

 

 

posted @ 2019-07-02 11:14  Boy岚  阅读(559)  评论(0编辑  收藏  举报