I am writing some code and realized I don't know which would be better to use. What would the benefits/drawbacks of each? I am currently using the one with the const uint16_t, because I thought templating it would expand the binary by creating unique function signatures. Thanks in advance for anyone who wants to help explain this!
template<typename T, uint16_t response_size>
T get_endpoint_value(const uint16_t endpoint_id)
vs
template<typename T, uint16_t response_size, uint16_t endpoint_id>
T get_endpoint_value()
vs
template<typename T>
T get_endpoint_value(serial::Serial* serial,
const uint16_t endpoint_id, const uint16_t response_size)
Where endpoint_id
is just a value that gets copied into a buffer. response_size
is used to size a uint_t buffer[response_size]
during a data transfer over serial.
Aucun commentaire:
Enregistrer un commentaire