Search Results - CodeGuru Forums
 CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: laserlight

Page 1 of 80 1

1. Thread: Recursive function: take a non-negative integer and print each digit of that integer

by laserlight
Replies
16
Views
536

Re: Recursive function: take a non-negative integer and print each digit of that inte

Hmm... I am not sure if I can articulate it precisely at the moment, so allow me to present examples.

Looking at the assignment requirements with TheGreatCthulhu's proposed amendment, it looks...
2. Thread: Recursive function: take a non-negative integer and print each digit of that integer

by laserlight
Replies
16
Views
536

Re: Recursive function: take a non-negative integer and print each digit of that inte

I think that the fact that it is not tail recursive does imply that an explicit stack is required, at least if you want an equivalent iterative solution rather than a different solution altogether.
3. Thread: Recursive function: take a non-negative integer and print each digit of that integer

by laserlight
Replies
16
Views
536

Re: Recursive function: take a non-negative integer and print each digit of that inte

Um, my statement was pertaining to the problem that Smitten posted about, with reference to TheGreatCthulhu's guess. I even mentioned that directly as a preface. I certainly did not state that an...
4. Thread: Recursive function: take a non-negative integer and print each digit of that integer

by laserlight
Replies
16
Views
536

Re: Recursive function: take a non-negative integer and print each digit of that inte

If TheGreatCthulhu's guess in post #3 is correct, then the expected recursive solution for the problem that Smitten was tasked with is not tail recursive, and the equivalent iterative solution...

by laserlight
Replies
63
Views
2,924

Re: Abstraction concept problem?

Agreed, though the alternative would be the more general term "reference", which of course has the potential for confusion because it does not mean the same thing as a C++ reference. This is...
6. Thread: C++ Class member function Bug Can't see it

by laserlight
Replies
16
Views
521

Re: C++ Class member function Bug Can't see it

Sorry, but your code fails to be const-correct, so your claim is not true. For example, a function could call GetMineralName then reasonably change the string content because GetMineralName returns a...

by laserlight
Replies
63
Views
2,924

Re: Abstraction concept problem?

I tend to agree with the notion of reference semantics as meaning both pointers and C++ references. After all, they both refer to something else, and that is an essential part of their meaning. Take...
8. Thread: Is Template Method design pattern and Hook the same thing by different names?

by laserlight
Replies
3
Views
255

Re: Is Template Method design pattern and Hook the same thing by different names?

It sounds like the terms are synonymous due to having been named in the literature at roughly the same time. (The GoF book was published in 1995.)

by laserlight
Replies
63
Views
2,924

Re: Abstraction concept problem?

You retain a copy, so of course there is a price to be paid for making and storing a copy.

by laserlight
Replies
17
Views
900

Re: New C++ versions

I have been known to use <iosteam> :p
11. Thread: How to avoid the copying from std::set<>?

by laserlight
Replies
6
Views
303

Re: How to avoid the copying from std::set?

Notice that they are not const member functions.
12. Thread: How to avoid the copying from std::set<>?

by laserlight
Replies
6
Views
303

Re: How to avoid the copying from std::set?

The issue is that you cannot arbitrarily change the value of an element of a std::set because it could mess up the ordering upon which the internal construction of the std::set is based. Therefore, a...

by laserlight
Replies
63
Views
2,924

Re: Abstraction concept problem?

Well yeah, but consider: it seems from implied context that you already have a CMesh object named m_WarehouseMesh. Therefore, you do not need to make a shared_ptr to point to a copy of it, so...

by laserlight
Replies
63
Views
2,924

Re: Abstraction concept problem?

Why are you using make_shared in this case?

by laserlight
Replies
63
Views
2,924

Re: Abstraction concept problem?

There is no such thing as a null reference in C++, so this cannot be done. However, there are a few options, e.g.,

Define a "null state" for the object, then...
16. Thread: A question regarding protected member

by laserlight
Replies
12
Views
376

Re: A question regarding protected member

Because the rule is that "an implicitly-declared copy/move assignment operator is an inline public member of its class" (C++11 Clause 12.8 Paragraph 22b). That the base class' copy assignment...
17. Thread: A question regarding protected member

by laserlight
Replies
12
Views
376

Re: A question regarding protected member

There is a rule that says that if you do not declare the copy assignment operator for a class, a copy assignment operator will be implicitly defined. This implicitly defined copy assignment operator...
18. Thread: A question regarding protected member

by laserlight
Replies
12
Views
376

Re: A question regarding protected member

Because foo has protected access, whereas the compiler supplied copy assignment operator for D has public access.
19. Thread: A question regarding protected member

by laserlight
Replies
12
Views
376

Re: A question regarding protected member

Class D has its own copy assignment operator provided by the compiler.

by laserlight
Replies
8
Views
472

Re: Getline error

In other words, as the compiler warnings posted by jlb1 point out, you are actually passing a null pointer constant to a constructor of the string object. Since that particular constructor expects a...
21. Thread: std::vector with negative subscript?

by laserlight
Replies
7
Views
330

Re: std::vector with negative subscript?

You cannot access an array with a negative subscript because that would be accessing the array out of bounds. What you can do is to have a pointer point to somewhere in the middle of the array, upon...
22. Thread: How to make boost catch some exceptions when a shared_ptr is null?

by laserlight
Replies
2
Views
227

Re: How to make boost catch some exceptions when a shared_ptr is null?

Why not just check if they are null smart pointers?
23. Thread: error C2678: binary '<' : no operator found which takes a left-hand operand...

by laserlight
Replies
4
Views
416

Re: error C2678: binary '

If you overload operator< as a non-member, then it should look like this:

bool operator < (const AABB& lhs, const AABB& rhs)
{
// ...
}
This function should be within the same namespace as...

by laserlight
Replies
10
Views
651

Note that this has also been posted elsewhere.
25. Thread: Using boost::shared_ptr in a std::set comparator?

by laserlight
Replies
2
Views
334

Re: Using boost::shared_ptr in a std::set comparator?

Where's the std::set?
Results 1 to 25 of 2000
Page 1 of 80 1