! @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 */
| 11640 | @since version 2.0.0 |
| 11641 | */ |
| 11642 | std::string to_string() const |
| 11643 | { |
| 11644 | return std::accumulate(reference_tokens.begin(), reference_tokens.end(), |
| 11645 | std::string{}, |
| 11646 | [](const std::string & a, const std::string & b) |
| 11647 | { |
| 11648 | return a + "/" + escape(b); |
| 11649 | }); |
| 11650 | } |
| 11651 | |
| 11652 | /// @copydoc to_string() |
| 11653 | operator std::string() const |