Dosti
Dosti

Reputation: 163

Type conversion to vector in C++

How to convert a RepeatedField<google::protobuf::uint32> to a const std::vector<double>?

Upvotes: 4

Views: 12591

Answers (1)

Kerrek SB
Kerrek SB

Reputation: 476930

That should be easy, since repeated fields act as containers:

void foo(RepeatedField<google::protobuf::uint32> const & f)
{
    std::vector<double> v(f.begin(), f.end());

    // use v
}

Upvotes: 15

Related Questions