Static Member Function - Function Pointer I apologize if this is the wrong forum, since it's specific to VMS. If anyone can suggest a better forum, I'll be happy to throw the question across. Anyways, trying to do a Loki port to VMS and came across a problem with using static member functions as arguments to C functions, specifically atexit. //This i... 15 Apr 2010 20:21
type of a lambda expression Hi, how can I declare a function which takes a lambda-expression. Naively, I tried // compile with gcc-4.5 -std=c++0x #include <iostream> using std::cout; using std::cerr; using std::cin; using std::endl; void calc(double x, double CVT(double)) { cout << "\nresult= " << CVT(x) << endl; } int ... 15 Apr 2010 02:38
template<unsigned char local_size, typename wide_type> struct fast_string{...}; Dear experts, I would like to create a custom string class to be used as the most efficient key possible in a map . Hash or tree, I'll have to bench to decide, so in fact I may have to create two custom string classes :) 1�) one tailored for fast compare (less) 2�) one tailored for fast hash and equality. Ho... 14 Apr 2010 06:34
[Help]An explicit instantiation of function template code: template <typename T> void f(T&) { cout << "void f(T&)" << endl; } template <typename T> void f(const T&) { cout << "void f(const T&)" << endl; } template <typename T> void g(T& t) { f(t); f<const T>(t); // My problem is *here* } My target is to call f(const T&) explicitly. The c... 13 Apr 2010 12:47
Type traits and accessibility According to N3092 - 11/5, "The interpretation of a given construct is established without regard to access control. If the interpretation established makes use of inaccessible member names or base classes, the construct is ill- formed". Does it mean that the following program is ill-formed? #include <ty... 17 Apr 2010 17:25
Iterating over a directory Hi! I'm just musing about how to write an STL iterator that walks over a directory. There are two things that create a problem for me: 1. For iterating, I need to use OS functions that allocate a resource. 2. Iterators are generally assumed to be copyable. Holding a resource that can't be copied poses the ques... 13 Apr 2010 20:41
Why using manystatic methods in a class Hi, I'm finding myself analyzing a fairly complex system log (library), where amazingly for me, many classes have lots, or even only, static methods! What strikes me the most, is that static methods are used even in base class, and classes that inherits from it have only static methods. Now, despite whether ... 20 Apr 2010 15:44
Errors using shared_ptr<> and get_deleter in g++-4.1/4.3/4.4 I'm trying to use shared_ptr and get_deleter in a library I'm developing, but having problems with syntax errors. Below is a reduced version that shows the errors I'm getting when building with g+ +-4.1/4.3/4.4: ================================================================== #include <iostream> // Fo... 13 Apr 2010 05:04
strict-aliasing warning workaround The following piece of code, which I believe is correct w.r.t strict- aliasing restrictions, generates a warning in gcc -O3 -Wall (tested 4.4.1 and trunk). This pattern is common, so it has to have come up for other people, so my question is: are there any good ways to achieve the same effect without getting the g... 13 Apr 2010 05:04
draft standard n3090.pdf, std::unique() algorithm Hello, In [alg.unique] 25.3.9 p884, I see the 2 versions of the unique function accepts 2 arguments of type ForwardIterator. However, in the Effects section, the conditions described are that: *(i-1) == *i or pred(*(i-1), *i) != false Am I misreading or is there an inconsistency? Regards, -- ... 11 Apr 2010 19:00 |