c++ use new to Image gdi+
im using gdi+ to output my images. i tried to use the keyword new but it didn't work. shot(L"image name") = new Image; that didn't work any other ideas how to make it work ...
im using gdi+ to output my images. i tried to use the keyword new but it didn't work. shot(L"image name") = new Image; that didn't work any other ideas how to make it work ...
all the STL containers that implement resize use copies to populate the new elements even if the source of the copy is a default constructed object? Why is it done this way? I see no advantage and some cost. As context, I ran across this while looking for a random access container for elements that can't be copied: ...
Hi, I got a C++ struct: struct Student{ Student(){ } }; And the enum: enum studenttype_t { levelA = 0, levelB = 1, levelC = 2 }; Then somewhere else it is declared: vector<Student *> student; Could it be used as follows: student[levelA] = new Student(); If so, what does the student[levelA] m...
I am building a Boost Python module (.so shared library file) which depends on another external library (STXXL) While I can build and import the example Boost Python modules, I run into problems when STXXL is thrown into the mix. Specifically when running import fast_parts in python I get ImportError: ./fast_parts.so: undefined symbol...
Hi, I hope someone might be able to answer why the following doesn't work. Bear with me though, I am still very much a noob... I just cannot get to the bottom of why the following using namespace std; #include <string> #include <iostream> class testClass { public: operator char* () {return (char*)"hi";}; operator int () {return 77;}...
When I create variable I just put the a name for it, but can I create the name of the variable like this: int var+1= 1; So basically that should be: int var1=1; I know I can't use the + sign to do that but is there way to do it? EDIT int g=1; string hello+g = "sdljfsdl"; // So hello+g will be hello1 So it is like mixing variabl...
Hi Guys, Just a small annoyance really as I can work around the problem by wrapping the derived function instead of using the 'using' keyword but why doesn't the following work (the compiler tells me that 'get_elem' is still pure virtual in 'Bar' class). class Elem {}; class DerivedElem : public Elem {}; class Foo { public: vi...
im trying to display image when left mouse button is down. i can display the image but if the left mouse button is down again than the older image would be deleted. here is my code display image function { Graphics graphics(hdc); POINT pt; GetCursorPos( ScreenToClient(hWnd, Image shot(L"RegularShots.png"); grap...
I just started studying C++, and I met this new guy: ->. I was wondering if it means something different than (.) or not, and if it does, what it is. Can you answer that? I looked for it a bit, but I didn´t find anything to answer my question. ...
Both can be used for communicating between different processes, what's the difference? ...
All thread create methods like pthread_create() or CreateThread() in Windows expect the caller to provide a pointer to the arg for the thread. Isn't this inherently unsafe? This can work 'safely' only if the arg is in the heap, and then again creating a heap variable adds to the overhead of cleaning the allocated memory up. If a stack...
So, I'm having a bit of pointer issues. I'm writing a function that stores memory addresses in a[]. These memory addresses point to actual data values in b[]. I'm having trouble getting the memory address from b to store in a. // Assume these are initialized to 0 outside of this snippet char a[100]; char b[100]; b[0] = 42; // Some valu...
Quoted here: hPipe = CreateFile( lpszPipename, // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe 0, // default attribut...
how will you define an object? ...
First: is it boost::noncopyable or booster::noncopyable. I have seen both in different places. Why would one want to make a class noncopyable? Can you give some sample use cases? ...
hi, SOCKET lhSocket; int iResult; lhSocket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); char *sendbuf = "this is a test"; iResult = send(lhSocket, sendbuf, (int)strlen(sendbuf), 0 ); printf("Bytes Sent: %ld\n", iResult); I have client and Server program using sockets in C++ now i send a buffer it is received by server now when server a...
Hi, I heard C++ templates wont generate errors until they are used. Is it true ? Can someone explain me how they work ? ...
Consider I have the following minimal code: #include <boost/type_traits.hpp> template<typename ptr_t> struct TData { typedef typename boost::remove_extent<ptr_t>::type value_type; ptr_t data; value_type & operator [] ( size_t id ) { return data[id]; } operator ptr_t & () { return data; } }; int main( int argc, char **...
this one i get as assignment in discrete maths. i try to do like this. procedure prime_numbers (x) n:= 1 for i:= to n<=x do n mod i=1 then return (prime) end prime_number. ...
Hello, Apparently the speed of the C++ linker in Visual Studio 2010 hasn't improved that much (about 25% in our case). This means that we're still stuck with linking times between 30 seconds and two minutes. Surely there are linkers out there that perform better? Does anyone have experience with switching to another linker or even a com...