# Revision history [back]

The shortest version of advertise is actually:

template<class M >
Publisher ros::NodeHandle::advertise(const std::string & topic, uint32_t queue_size, bool latch = false)


Since this is templated on the message type (M), and the message type doesn't appear in the argument list, the message type cannot be inferred from the template arguments, so you must specify it.

Therefore you call: nh.advertise<visualization_msgs::Marker>("visualization_marker",1); , and the third latch argument will default to false.

This simpler variant of ros::NodeHandle::subscribe is only templated on the message type:

template<class M >
Subscriber ros::NodeHandle::subscribe(const std::string &   topic, uint32_t queue_size, void(*)(M) fp, const TransportHints & transport_hints = TransportHints())


And since the message type (M) can be inferred from the type of fp (void(*)(M)), you don't need to specify any template arguments. (similarly, the transport_hints argument here also uses the default value).