7#include <viam/api/common/v1/common.pb.h>
15template <
typename Src,
typename Dst>
16void vecToRepeatedPtr(
const std::vector<Src>& vec, google::protobuf::RepeatedPtrField<Dst>& dest) {
18 dest.Reserve(vec.size());
20 *dest.Add() = x.to_proto();
26template <
typename Src,
typename Dst>
27void vecToRepeatedPtr(
const std::vector<Src>& vec,
28 google::protobuf::RepeatedPtrField<Dst>& dest,
29 Dst to_proto(
const Src&)) {
31 dest.Reserve(vec.size());
33 *dest.Add() = to_proto(x);
39template <
typename Src,
typename Dst>
40void repeatedPtrToVec(
const google::protobuf::RepeatedPtrField<Src>& src, std::vector<Dst>& vec) {
42 vec.reserve(src.size());
44 vec.push_back(Dst::from_proto(x));
50template <
typename Src,
typename Dst>
51void repeatedPtrToVec(
const google::protobuf::RepeatedPtrField<Src>& src,
52 std::vector<Dst>& vec,
53 Dst from_proto(
const Src&)) {
55 vec.reserve(src.size());
57 vec.push_back(from_proto(x));