Updated specific locations to be searchable, take a look at Las Vegas as an example.

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

3
Optional references via `std::optional<T>`?
Post Flair (click to view more posts with a particular flair)
Post Body

I'm working on a compiler for one of the courses I need for my degree and I need to modify a major part of it (the expression evaluator) to handle optional references (I could just overload the entire thing but I don't want to duplicate code and create more work for myself). I came across std::reference_wrapper (and its helper functions, std::ref and std::cref). My question is: is it legal and okay to create an std::optional<std::reference_wrapper<T>> as a function parameter (since an std::optional<T&> is illegal)? If I, say, have an std::optional<std::reference_wrapper<std::stringstream>> and I want to write data to it and have that data remain when I return to the caller, would it be fine to use that (std::optional<std::reference_wrapper<std::stringstream>>) when declaring the function, or is this bad practice? Is there some better way I can use (while trying to avoid pointers)?

Author
Account Strength
60%
Account Age
3 years
Verified Email
Yes
Verified Flair
No
Total Karma
113
Link Karma
84
Comment Karma
29
Profile updated: 1 day ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago