Commit 4fd1c4d7 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Kenton Varda

Give an example of returning an owning string for KJ_STRINGIFY

I initially didn't read the docs carefully enough and returned a StringPtr to a locally allocated string. Whoops. Make the doc a little clearer about this.
parent f32a8bc1
......@@ -487,6 +487,8 @@ inline _::Delimited<ArrayPtr<const T>> Stringifier::operator*(const Array<T>& ar
//
// class Foo {...};
// inline StringPtr KJ_STRINGIFY(const Foo& foo) { return foo.name(); }
// // or perhaps
// inline String KJ_STRINGIFY(const Foo& foo) { return kj::str(foo.fld1(), ",", foo.fld2()); }
//
// This allows Foo to be passed to str().
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment