|
basic c++ inquiry char getChoice(const char* prompt, const char* allowed); display prompt and get user input (a char) if user entered a valid char (it is within "allowed" string), then return that char if char is not valid, display error and repeat until a valid character is entered This is an assignm... 28 Jun 2008 18:50
Why not reject the dynamic instantiation of a class with non-virtual destructor? On 27 Jun., 22:25, "Angel Tsankov" <fn42...(a)fmi.uni-sofia.bg> wrote: Hi, Why not treat as erroneous a new expression that creates an instance of a class which has a (direct or indirect) base class with a non-virtual destructor and require implementations issue a diagnostic message? This would minimize... 3 Jul 2008 05:19
Example (3.3.6) from standard puzzles me In chapter 3.3.6 of the standard (draft) an example is given that puzzles me. Why is f() okay? The rule says that the result must be the same when the full class definition has been seen. But why does sizeof right away use X::c whereas g uses double type? That is i in main receives 1 - whereas I expected e.g. 8... 28 Jun 2008 18:50
Public member variables acceptable? I made it a habit to always, without any exception, declare my member variables private. However, there are some situations where it seems that it's ok to make an exception. For example in a Point class: class Point { public: Point(); Point(int inX, int inY); int x; int y; }; Would ... 10 Aug 2008 01:48
Why not reject the dynamic instantiation of a class with non-virtual destructor? "Angel Tsankov" <fn42551(a)fmi.uni-sofia.bg> writes: Why not treat as erroneous a new expression that creates an instance of a class which has a (direct or indirect) base class with a non-virtual destructor and require implementations issue a diagnostic message? Becasue the error is not in the new expres... 28 Jun 2008 02:29
problem with iterator declaration within template Here is the template definition: #include <string> #include <map> template <typename HNDTYPE> class resmap { public: struct resnode { bool mark; HNDTYPE handle; }; typedef std::map<std::string, resnode> maptype; .... and here is the problem line: template <typename HNDTYPE>... 27 Jun 2008 16:16
template problem Hi all, Below is a short program where I define a class A, in which I redefine the operator =. Inside the operator implementation, it just prints a line to notify that it is indeed the new assignment operator which is called. In main(), I define two variables a and b, both of the same type A<int>. Then I wr... 28 Jun 2008 18:49
Why not reject the dynamic instantiation of a class with non-virtual destructor? Hi, Why not treat as erroneous a new expression that creates an instance of a class which has a (direct or indirect) base class with a non-virtual destructor and require implementations issue a diagnostic message? This would minimize the chances for resource leaks and for undefined behaviour in C++ programs. ... 3 Jul 2008 10:26
A vector of strings I am writing code to put C-style command line arguments (int argc, char *argv[]) into a vector of strings (std::vector<std::string> theArgv). I have a question: Is it better to do a) theArgv.push_back(argv[i]); or b) theArgv.push_back(std::string(argv[i])); or are these identical? -- [ See http... 28 Jun 2008 03:30
Smart Pointer problem { Please avoid too long lines; it's best to limit your text to 70 columns or so, less than 80 at least. In addition, please consider using a charset that fits the English environment better, such as US-ASCII or ISO-8859-*. -mod } We have our smart pointer implementation. But the operator -> is creating ... 27 Jun 2008 16:16 |