Click here to Skip to main content
15,885,649 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Where I can learn about using wsprintf? Pin
GESY27-Jul-18 4:07
GESY27-Jul-18 4:07 
AnswerRe: Where I can learn about using wsprintf? Pin
Richard MacCutchan26-Jul-18 22:13
mveRichard MacCutchan26-Jul-18 22:13 
QuestionReturn nothing from a function having return type Pin
meerokh26-Jul-18 0:40
meerokh26-Jul-18 0:40 
AnswerRe: Return nothing from a function having return type Pin
Richard MacCutchan26-Jul-18 1:28
mveRichard MacCutchan26-Jul-18 1:28 
GeneralRe: Return nothing from a function having return type Pin
Member 1392860827-Jul-18 11:43
Member 1392860827-Jul-18 11:43 
GeneralRe: Return nothing from a function having return type Pin
Richard MacCutchan27-Jul-18 21:54
mveRichard MacCutchan27-Jul-18 21:54 
AnswerRe: Return nothing from a function having return type Pin
Jochen Arndt26-Jul-18 1:48
professionalJochen Arndt26-Jul-18 1:48 
AnswerRe: Return nothing from a function having return type Pin
Joe Woodbury26-Jul-18 5:44
professionalJoe Woodbury26-Jul-18 5:44 
If you are using C++17, there is std::optional designed just for this situation. You could return a raw pointer (assuming the collection outlives the use of its objects), a unique_ptr (construct a new object) or shared_ptr (and store the Packages as shared_ptr objects).

Another option is to pass a non-const reference to a Package and have the method return a bool indicating success or failure.

As has been pointed out, you could also return an empty object. This is the only choice if your design is constrained to return just an instance.
QuestionNo Errors but wrong values on return? Pin
GESY25-Jul-18 16:02
GESY25-Jul-18 16:02 
AnswerRe: No Errors but wrong values on return? Pin
Victor Nijegorodov25-Jul-18 20:52
Victor Nijegorodov25-Jul-18 20:52 
GeneralRe: No Errors but wrong values on return? Pin
GESY26-Jul-18 7:58
GESY26-Jul-18 7:58 
GeneralRe: No Errors but wrong values on return? Pin
Victor Nijegorodov26-Jul-18 8:20
Victor Nijegorodov26-Jul-18 8:20 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 3:55
GESY27-Jul-18 3:55 
AnswerRe: No Errors but wrong values on return? Pin
Richard MacCutchan25-Jul-18 23:42
mveRichard MacCutchan25-Jul-18 23:42 
GeneralRe: No Errors but wrong values on return? Pin
GESY26-Jul-18 7:56
GESY26-Jul-18 7:56 
QuestionRe: No Errors but wrong values on return? Pin
David Crow26-Jul-18 17:11
David Crow26-Jul-18 17:11 
GeneralRe: No Errors but wrong values on return? Pin
Richard MacCutchan26-Jul-18 22:08
mveRichard MacCutchan26-Jul-18 22:08 
SuggestionRe: No Errors but wrong values on return? Pin
David Crow26-Jul-18 17:14
David Crow26-Jul-18 17:14 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 4:02
GESY27-Jul-18 4:02 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 4:49
GESY27-Jul-18 4:49 
AnswerRe: No Errors but wrong values on return? Pin
David Crow27-Jul-18 4:53
David Crow27-Jul-18 4:53 
AnswerRe: No Errors but wrong values on return? Pin
Richard MacCutchan27-Jul-18 1:13
mveRichard MacCutchan27-Jul-18 1:13 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 3:58
GESY27-Jul-18 3:58 
GeneralRe: No Errors but wrong values on return? Pin
GESY27-Jul-18 4:53
GESY27-Jul-18 4:53 
AnswerRe: No Errors but wrong values on return? Pin
David Crow27-Jul-18 4:57
David Crow27-Jul-18 4:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.