override operator new within a file?340 (3/6/2007 8:41:02 PM) comp.lang.c++ A coworker asked me this. I gather he's trying to track down a memory leak. Is is possible to override operator new (and delete) only within a single file? ... Mark
Is this safe? #2920 (2/13/2007 2:53:08 AM) comp.lang.c++ Is the following safe: double min_value = -numeric_limits::max(); Basically, I'm trying to get a negative number with a very large magnitude. Thanks, Mark ... Mark
Number of elements in an enum821 (1/12/2007 7:50:42 PM) comp.lang.c++ I'm working on a project where I have something like enum Modes {mode_a, mode_b, ...}; Due to project spec changes, the number of Modes has increased several times. There are a few places where it's useful ... Mark
minimum float value133 (12/21/2006 6:32:01 PM) comp.lang.c++ I have a float value which should be initialized to the minimum allowed value (analogous to -infinity). I discovered today (thank you, unit tests!) that numeric_limits::min() returns a very small number gre... Mark
max_element with binary predicate245 (10/26/2006 11:09:07 PM) comp.lang.c++ I'm trying to use max_element with a binary predicate. Here's an illustrative sample of the compilation problem I'm having. The compiler reports: closer.cpp:30: cannot convert `__gnu_cxx::__normal_iterator... Mark
unique elements of an array524 (10/21/2006 12:19:21 AM) comp.programming Consider an array A of N values. We wish to obtain an array B containing exactly one instance of any value which appears one or more times in A. The obvious approach is to sort A and then make a single pass... Mark
friendship with dependencies245 (10/12/2006 10:41:18 PM) comp.lang.c++ Is there a way to do anything like the following: class A { friend void B::foo(); ... }; class B { void foo(); ... A my_a; }; This is very much simplified, but basically B depends upon A so t... Mark
getline questions225 (9/27/2006 11:14:46 PM) comp.lang.c++ Consider the following snippet of code to read lines from a text file: ifstream file_stream( "some_file.txt"); string read_line; while( file_stream) { getline( file_stream, read_line); } I've tried this on... Mark
where do you put comments?1020 (9/22/2006 1:13:31 AM) comp.programming Consider any of the many languages in which code is typically divided between header files and implementation files. Now consider a function which is declared in a header and implemented elsewhere. If you w... Mark
Absolutely newbie question425 (11/2/2007 11:01:51 PM) comp.lang.c++ Is it possible to build an application with windows (i.e. not running through the console) by using c++? Are there any special libraries I should use? I am working with ubundu, so is Eclipse suitable? Does it m... adamtsa
intersection of two std::maps628 (11/5/2007 6:42:04 PM) comp.lang.c++ Hi! What is the canonical way of finding an intersection of two std::maps? i.e. I have std::map map1; std::map map2; .... and I need an std::vector containing all the values that occur simultaneously in... jacek.dziedzic(22)
map in stl730 (11/8/2007 10:02:48 AM) comp.lang.c++ I'm using a map for storing information. With lower_bound i can find keys equal to or greater then the key i give as a parameter. With upper_bound i can find keys greater then the key i give as a parameter. ... nospam48(2677)
Use of std::vector slower than arrays?2222 (11/12/2007 11:40:49 PM) comp.lang.c++ Hi. I was writing a bignum package in C++. I noticed that a version of an addition routine I had written using std::vector was a lot slower than one using simple "C-style" arrays, and this raises the question:... mike4ty4(405)
std::sort #21539 (11/26/2007 10:27:06 PM) comp.lang.c++ Would std::sort ever compare an object with itself? I'm not talking about two distinct, equal-valued objects, but rather this == &that. The container being sorted is a std::vector. I've never seen this, but a... jeff34(1594)
STL: Could you make this snippet more efficient1225 (12/3/2007 7:30:41 PM) comp.lang.c++ Dear comp.lang.c++, Could you make this snippet more efficient? As you see I have too many variables introduced in the code. //Read set of integers from a file on line by line basis in a STL set //fp is pre-d... pedagani(29)
strange test question2140 (12/4/2007 11:52:35 PM) comp.lang.c i got the following strange extra question in a written test today . since the test was abt c/c++ i guess this is on topic here --8<-- 22) Consider the following quote: "If Mickey's a mouse, Donald's a duck,... lanius(14)
Vector erase dumps core when vector size is 2529 (12/5/2007 11:01:34 PM) comp.lang.c++ I am facing problem while erasing an elemet from stl vector when its size is 2. It works fine when SIZE > 2. Can anybody help me in this?? Following is the sample code which i tried. #include #include using... anil.pundoor(28)
bogus entries in map (std library)421 (12/12/2007 6:24:16 PM) comp.lang.c++ Hi, I am getting zero as value for some keys in my map which can never happen as per my understanding of my code. These are the details: I have defined an array of vectors, where each vector element is a map,... suresh.amritapuri(100)