! @brief return a string representation of the JSON pointer @invariant For each JSON pointer `ptr`, it holds: @code {.cpp} ptr == json_pointer(ptr.to_string()); @endcode @return a string representation of the JSON pointer @liveexample{The example shows the result of `to_string`.,json_pointer__to_string} @since version 2.0.0 */
| 10136 | @since version 2.0.0 |
| 10137 | */ |
| 10138 | std::string to_string() const |
| 10139 | { |
| 10140 | return std::accumulate(reference_tokens.begin(), reference_tokens.end(), |
| 10141 | std::string{}, |
| 10142 | [](const std::string & a, const std::string & b) |
| 10143 | { |
| 10144 | return a + "/" + escape(b); |
| 10145 | }); |
| 10146 | } |
| 10147 | |
| 10148 | /// @copydoc to_string() |
| 10149 | operator std::string() const |