Defined in header <cparse/Cursor.hh>

std::shared_ptr<std::string> getLocation() const noexcept;

Returns the internal std::shared_ptr<std::string> that holds the filename passed to the constructor. Multiple cursors constructed as copies of one another share this pointer, so pointer equality on the result is a cheap "same source?" check.

Parameters

None.

Return value

A shared pointer to the filename string. May be null-valued behaviour does not arise in practice: the constructors always allocate a string, even when the filename argument is empty.

Exceptions

noexcept.

Notes

Used internally by Cursor::operator== for its "same source" comparison, which is why that operator's filename check is by pointer identity rather than string content. Grammars rarely call getLocation() directly — getFilename() is usually what they want.

See also