I have a C ++ project. I am working on a project to teach myself how to create a semi-realistic C ++ program. It recursively downloads content from a website.
Each download has a URL for the downloaded content, as well as a referrer URL (or the URL of the page on which the content was extracted).
There is always a referrer if it is not the very first URL. I cheated and just looked at the first URL as my own referrer. I recently changed the URL class to have an empty (or empty) representation. It looks like a hack.
Is there a way to represent optional objects in C ++ without:
- Using pointers?
- Drop space for invalid object?
- or creating an "empty" version of an object?
source share