Return const reference

This commit is contained in:
Esteve Fernandez 2015-05-05 10:32:23 -07:00
parent 3b475de093
commit 1fe3fe0208

View file

@ -150,7 +150,8 @@ public:
return value_.bool_value;
}
template<ParameterType type>
typename std::enable_if<type == ParameterType::PARAMETER_BYTES, std::vector<uint8_t>>::type
typename std::enable_if<type == ParameterType::PARAMETER_BYTES,
const std::vector<uint8_t> &>::type
get_value() const
{
if (value_.parameter_type != rcl_interfaces::ParameterType::PARAMETER_BYTES) {
@ -168,7 +169,10 @@ public:
bool as_bool() const {return get_value<ParameterType::PARAMETER_BOOL>(); }
std::vector<uint8_t> as_bytes() const {return get_value<ParameterType::PARAMETER_BYTES>(); }
const std::vector<uint8_t> & as_bytes() const
{
return get_value<ParameterType::PARAMETER_BYTES>();
}
private:
std::string name_;