template class and non-template class8155 (9/24/2010 4:38:34 PM) comp.lang.c++.moderated I have a template class which I'd like to have a non-templated version
of - it's templated on a size_t which is currently a compile time
constant. I now need to make an almost identical class, except with
th... ThosRTanner
Is it dangerous to pass a temp variable to throw1128 (5/21/2010 4:06:31 PM) comp.lang.c++.moderated for instance
class Except { public: template Except &operator<<(T const
&); };
throw Except() << "went bang";
In our version of lint, this gets an error about initialising a non-
const reference wit... ThosRTanner
order of destruction, singletons & std::ostream3159 (8/8/2007 9:54:45 AM) comp.lang.c++.moderated We have a class in our system which is a singleton and it has 2 std::auto_ptr members. You get hold of the instance by calling the getInstance() method which is inlined and does inline Fred& Fred::getInstance(... ThosRTanner
temporary objects2126 (7/19/2007 8:58:00 AM) comp.lang.c++.moderated This question is vaguely related to messages related by gimpel software flexelint. It says this sort of thing: class Proxy { public: Proxy(int); ~Proxy() { //basically, outputs the buffer ... ThosRTanner
avoiding duplicate code3173 (7/18/2007 6:59:51 AM) comp.lang.c++.moderated How does one avoid writing duplicate code for 'find' in an stl-like class. One has to write a const and a non-const version, thus iterator find(T t); and const_iterator find(T t) const; but I tend to find the ... ThosRTanner
wrapper classes and pointers2140 (6/29/2007 6:59:19 AM) comp.lang.c++.moderated We have a class whose instances tend to be passed around by pointer, of the sort of thing Thing *pointer; pointer = Thing::get_instance(); //Somewhat later pointer->some_operation(); Now, we want to wrap Th... ThosRTanner
pimpl and const correctness6130 (6/27/2007 6:23:27 AM) comp.lang.c++.moderated Question: Why does this: class splog { int *wibble; public: void bork() const { * wibble = 1; } }; void jim(splog const&will) { will.bork(); } compile? It seems a pretty dangerous... ThosRTanner
use of "inline"392 (4/2/2007 11:52:22 AM) comp.lang.c++.moderated I'm somewhat confused as to how I should read the standard about inline functions. Section 7.1.2 reads: A function declaration (8.3.5, 9.3, 11.4) with an inline specifier declares an inline function. So, what... ThosRTanner
pthread_join "quirk"6181 (8/4/2006 3:17:42 PM) comp.unix.programmer I suspect this might be solaris specific, but anyway: I have a program which does this: pthread_t threads[max_threads]; for (t = 0; t < max_threads; ++t) { int err; while (err = pthread_create(&thread[... ThosRTanner
std::string, c_str and optimisers2091 (5/31/2006 3:04:06 AM) comp.lang.c++.moderated Question: At what point should the destuctor of a string be invoked. I have some code which does something like this: std::string s; char const *t; ,,,, read s from a file ... t = s.c_str(); //s is never used... ThosRTanner
When to use #include <> and #include " "1818 (5/17/2005 12:58:10 PM) comp.lang.c++ My question is, if I have created my own library which lives in its own install directory, to refer to its header file is it better to use #include "MyLibrary.h" or #include Assume that this library will b... matt9320(1)
std::ifstream with thread747 (9/9/2010 11:37:31 AM) comp.lang.c++ Hi, I'm writing a multithreaded program, which must read some files. I create my thread and run them. Each thead holds a list with filenames, but this list is not unqiue for the thread, so more than one thre... philipp.kraus(151)
Which casting conversion to use for void*?2830 (5/8/2011 10:44:50 PM) comp.lang.c++ Which should I use correct casting conversion after I create void variables? For example: void *memory = malloc( 0x1000 ); char *pString = static_cast( memory ); or char *pString = reinterpret_cast( memor... immortalnephi(95)
Throwing unexpected exceptions641 (6/16/2011 8:50:55 AM) comp.lang.c++ In Stroustrup's "The C++ programming language" I read that throwing an exception that is not declared to be expected in a function causes std::unexpected() to be called. I tried the difference with the followi... urs(44)