It would help if you'd put the decalaration of all variables and types in your code.
E.g. - what is searchVal and what is a linked-list item looks like?
Type: Posts; User: Shmulik
It would help if you'd put the decalaration of all variables and types in your code.
E.g. - what is searchVal and what is a linked-list item looks like?
If you posted the compiler error - it was a great help.
My guess is that maybe c or c.affects are const, and therefor, their iterator is const_iterator.
But please send the exact compiler error...
Well VC++ is the tool we have - for good and for bad.
My code should also be ocmpiled on various Unix platforms, so I need to conform to "some" standard.
Hey, how did you become a member?
I haven't yet saw an IDE even try to compete with VC++.
I admint I didn't try t oexplore all IDEs on unix X windows..., but I suspect even there, nothing compares VC++, espacially when it is with...
well, you do have a point ergarding why it is good to return a const object, but regarding the standard, we both don't know it, so I'm not sure GNU ++ is better then VC++.
According to VC++ message...
What is high_limit definition?
well, I don't have the official ANSI standard, but from what I found in the net and my books about it, I think Eckel is wrong by saying (in page 284, first edition) that temporary objects are...
Do you have any proof that "temporary objects are const according to ANSI C++ standard"?
Anyone lese have heard about it?
I can't see any reason why it should be that way.
why can the returned object be an l-value?
suppose the class has a non-const method that evaluated a value and output it, why shouldn't we allow a syntax like
(sp1+sp2).EvalAndOutput() ?
since...
if you return an object adn not a reference, it doesn't have to be const.
yeah, me too :(
well to solve that - if you're not sure if your static memeber will be used in static objects, I'd use an inline method as you suggested.
this code is actually C++ - it uses cin, cout, new and delete.
The only thing "C" about it is printf.
lookup printf in your documentation.
what this lines mean is to print a string. the first...
If you define the static outside the class it should have no impact on performance. It is surely better then a function (even inlined).
Static objects are intialized once durint program startup.
...
as mentioned above you should make it a static member.
However the code you wrote won't compile. static memebers are declared inside the class, but should be defined outside of hte class definition....
seems fine, except that you forgot to delete pPerson
I suggest you show us a piece of you code that wirtes over the file, and we'll correct it to appending to the file...
most operating system has a term called "return value", meaning that when a process is terminated, it returns a value, also called an error code. this is the normal way for the process to let the OS...
If you lookl at your code, you can see that person, person1 and person2 are defined in the funcion main(), this means that the methods civInfo(), govInfo() & milInfo() knows nothing about them.
But,...
That's the beuty of C++ and the STL - if it doesn't compile, you missed a requirement. look at your compiler output, and correct your class accordingly.
Not sure?
New / delete are much better in this area than malloc, because you don't even have to case.
simply use:
class MyClass {
...
}
int x = GetCount();
MyClass* list = new MyClass[x];
Well, let's see:
Say you have-
Result r;
So the first first student would be:
r.students[0]
Use erase() instead of clear() .
I don't know where your book took it, but in STL, the efficient way to clear a string is theString.erase();
I don't know where your book took it, but in STL, the efficient way to clear a string is theString.erase();