First  |  Prev |  Next  |  Last
Pages: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Why is the return type of count_if() "signed" rather than "unsigned"?
{ Please include some quoting to establish the context. -mod } I want to know why rather than what and how. Much to my surprise, why does not the C++ standard define the return type as "unsigned integral type"? What's the fundamental reason to define it as "signed"? distance() may return negative number, it is ... 26 Jun 2010 04:22
a bit of reflection (doesn't work)
Hello, i tried this one here to get information, if a class X inherits from a Feature class: ------------------------- snip ---------------------------------------- #include <iostream> using namespace std; struct NO { static const int VALUE = 0; }; struct YES { static const int VALUE = 1; }; na... 24 Jun 2010 08:30
Why is the return type of count_if() "signed" rather than "unsigned"?
As we know, count_if() will never return a negative number. So, it seems evident that the return type of count_if() should be "unsigned integral type" rather than existing "signed integral type". However, to my surprise, the C++ standard should define the return type is "signed integer type", which causes a lot o... 22 Jun 2010 19:20
future of the C++
Hello! Forgive me if my question is stupid and english is not native for me., but it worries me! I'm not very experienced programmer. I really like C + + and I want to become a good programmer. But something that bothers me. Will C + + language is enough demand in the near future? Will it continue to use many, ... 29 Jul 2010 14:04
Generating a derived class from a base class
Hello, I have a base class with a number of pure virtual functions. I will have to write a large number of derived classes and I wish to generate the derived class definitions programmatically as containing the list of all pure virtual functions present in the base class. class Base { public: <function de... 22 Jun 2010 19:21
Comparing Multiple Strings More Efficiently
I think there are better (more efficient) ways to do this, but I've only ever needed this simple approach: void compare(const std::vector<std::string>& strings) { // Normally, this is randomly generated. It is a C style string. char the_string[4] = "abc"; std::vector<std::string>::const_iterator s... 10 Jul 2010 14:54
New types defined in a return type
Hello Is this legal C++: struct Coord { int a; float f; } GetLastCoord() { Coord c; c.a = 0; c.f = 2.7f; return c; } ? I could not find the paragraf for that in the standard. gcc gives an error and Visual Studio compiles the code Thank you, Timothy Madden ... 21 Jun 2010 19:09
member iterator - request for comment
Hi, Recently I've met the need to perform operations like this quite often: struct A { int val; } .... std::vector<A> as; .... std::set<int> vals; std::vector<A>::const_iterator it, end = as.end(); for (it = as.begin(); it != end; ++it) { vals.insert(it->val); } that is, to perform some acti... 23 Jun 2010 10:35
STL::glice vs cstdio
I have some code where executing some completely irrelevant calls in cstdio causes gslice to throw a segmentation fault; a previous code (which was buggy) caused the use of gslice to cause cerr/cout to throw away all their output! Now, the most likely explanation is that I have missed some critical constraint on... 5 Jul 2010 14:25
Is this ambiguous ? Templates parameter deduction.
struct Base { int b; }; struct Derived : Base { int d; }; template<typename Obj> bool foo_mem(Obj& obj_, int Obj::* mem) { return true; } int main() { Derived d; foo_mem(d, &Derived::b); // is Obj ambiguous ? foo_mem(d, &Base::b); // is Obj ambiguous ? return 0; } Gcc ... 20 Jun 2010 15:38
First  |  Prev |  Next  |  Last
Pages: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25