Search:
Type: Posts; User: laserlight
Search:
Search took 0.25 seconds.
-
January 21st, 2020, 02:40 AM
Your declaration of f in D is an overload, not an override. If I remember correctly, it even hides the virtual function f inherited from C.
What's the "right function" to invoke for the D object...
-
December 26th, 2019, 07:28 PM
Neither BaseEntity nor Entity are abstract classes since they don't have any pure virtual member functions (or even any virtual member functions, for that matter).
What I'm curious about is...
-
December 13th, 2019, 02:33 PM
No, I think ordinary functions are allowed as long as they take the two required parameters and return bool according to the strict weak ordering requirement. The advantage of a function object lies...
-
December 13th, 2019, 02:29 PM
Ah, pardon the lack of clarity: I meant "faster" as in "faster feedback". That is, if you have a question like "will this code below produce this result?", you'll get faster feedback on your question...
-
December 13th, 2019, 02:05 PM
The comparator is required to model a "less than" comparison, or what they call comparing for "strict weak ordering". What this means is that if A "less than" B is true, then B "less than" A must be...
-
December 11th, 2019, 05:03 PM
If you mean '0' to '9' then yes due to fallthrough, but for this kind of question it is usually faster to write a test program and see for yourself.
-
August 24th, 2019, 07:29 PM
This is unnecessarily convoluted:
volo *app = new volo(cod, n, c);
flight.push_back(*app);
delete app;
It would suffice to write:
flight.emplace_back(cod, n, c);
Even if you had to compile...
-
Yes, but C++ has a richer library of generic algorithms, and in this case the next function is more akin to the overly generic std::for_each than to a more descriptive generic algorithm. If you look...
-
If you want to specifically remove spaces from a string s, then the simplest option would be:
s.replace(' ', '')
If you want to remove whitespace in general, then aakashdata's first example would...
-
Yes, I read your statement again and decided it was unfair to attribute rudeness to you when it can be explained otherwise. My apologies as it means that it is I who became rude.
For what's it's...
-
Yes, I agree. My point is that it's also possible to over-engineer to handle things that don't matter, and in general we should be aware of that too.
I initially took this as a snide remark,...
-
Sure, but by and large for the kind of strings that people want to check if they are palindromes, this doesn't matter: they are so short that O(N) complexity is meaningless versus amortised O(1)...
-
It really doesn't have to be that complex:
def isPalindrome(text):
return text == ''.join(reversed(text))
-
April 8th, 2019, 10:54 PM
If you tested the code, you would have found out that you have a typo on this line:
pp.pushback(temp);
It should have been:
pp.push_back(temp);
You're probably going to use a loop, so...
-
March 28th, 2019, 05:59 AM
Wouldn't normal input redirection work? Say:
$ gcc --save-temps --verbose ex1.c -o ex1 2> gcc_errors.txt
-
March 24th, 2019, 05:21 AM
A quick check shows that if the version of MinGW that came bundled with Dev-C++ 5.5.2 properly conformed to POSIX, then #include <stdlib.h> should have been sufficient: you don't need to forward...
-
November 19th, 2018, 12:03 AM
It might be helpful if you printed the addresses of the objects as well, and implemented the copy constructor see it being invoked:
#include<iostream>
using namespace std;
struct st {
...
-
October 29th, 2018, 03:50 AM
Post the smallest and simplest compilable version of your program that demonstrates this error.
-
August 20th, 2018, 09:23 PM
I'd say that at an architectural level, SRP could be along the lines of dividing a large project into smaller subprojects that do one thing and do it well, although that "one thing" is much larger in...
-
July 22nd, 2018, 11:45 AM
This is bad for two reasons:
Your header files are no longer self-contained, i.e., it is now an unusual mysterious convention that when someone includes your header files, they must first have a...
-
June 17th, 2018, 05:26 AM
Why can't it be a member function that takes no arguments? It also, looks like you can just use std::swap to implement the function.
I note that your Insieme constructor implementation looks...
-
June 15th, 2018, 04:00 AM
It depends on what does "conversion to int" mean for your class. Once you can clearly define what it means for your class, you can then define it in code. Sometimes (or rather quite often)...
-
June 13th, 2018, 05:47 PM
It might or might not be, so you shouldn't assume either way. Rather, you should declare variables near first use so that they can be initialised to point to something, and if that's not feasible,...
-
June 10th, 2018, 03:09 AM
Well, if you want the derived class to be a concrete class such that you can instantiate objects of that class, then you do need to define the pure virtual member functions inherited from the...
-
Examples are just examples. They can help you to gain in understanding, but you don't have to copy them once you understand what the things they do are about. The point is, you need to understand...
|
Click Here to Expand Forum to Full Width
|