How can I convert grpc::string_ref
to a std::string
to be used in internal library call?
I am trying to pass const grpc::string_ref& to jwt::decode(const std::string&)
call
Ans: It seems grpc::string_ref
provides the iterator and string is saved as char*
, So the iterator can be used to iterate over the string_ref and append and create a std::string
You can use std::string
's iterator constructor (6).
jwt::decode(std::string(ref.begin(), ref.end()))