| 94 | /// Returns a new block with the given ID or creates a new one if necessary. |
| 95 | template <class T> |
| 96 | T* get(int id, std::string_view description, |
| 97 | const detail::source_location& loc) { |
| 98 | auto& result = steps[std::make_pair(id, example_id)]; |
| 99 | if (!result) { |
| 100 | result = std::make_unique<T>(this, id, description, loc); |
| 101 | } |
| 102 | return static_cast<T*>(result.get()); |
| 103 | } |
| 104 | |
| 105 | /// Tries to find the first step that immediately precedes `caller_id` in the |
| 106 | /// execution path. Returns `nullptr` if no such step exists. |