This piece of code gives me an error
struct state{
int time_taken;
vector<int>time_live;
string loc_name;
vector<int>loc;
};
for(int u=0;u<(A[start].loc.size());u++)
{
l=A[start].loc[1];
if(A[l].time_taken < min_time)
{
min_time=A[l].time_taken;
finish = l;
}
}
This gives a segmentational fault .
...
Hello,
How can I draw a selection rectangle on my screen with Qt in X11?
I want to be able to drag a rectangle on my screen (outside of the application) and then save the whole rectangle.
Thanks in advance.
...
Hello
Is it valid to have a std::pair of references ? In particular, are there issues with the assignment operator ? According to this link, there seems to be no special treatment with operator=, so default assignement operator will not be able to be generated.
I'd like to have a pair<T&, U&> and be able to assign to it another pair (o...
Hi,
I download this program, and I add a little modification. When I compile this I see this errors. I found in Internet solution, that this parameters
-lole32 -lkernel32 -lgdi32 -luuid -luser32
help me. I add this to linker and dev c++ throw me this errors
What is wrong? What parameters I must add?
...
I am using async_read with streambuf. However, I would like to limit the amount of data read to 4, so I can properly handle header before going to body.
How can I do that using async_read?
...
We have a base TCP Server class which provides Server functionallity. Now we want to provided secure TCP Server functionality as well. There were two approaches we were debating on.
Pass a value to TCP server constructor, indication whether it should act as TCPServer or TCP secure server.
Create a TCPSecure class inheriting from TCP Se...
I have a actionscript 3 based desktop Flash app which has its own event model(GUI component) and another native c++ application(business logic) which has its own model. I want to connect them and have a middleware module which can act like an arbiter between the two and dispatch events across the two components according to some model lo...
I am using Xerces library, everything is fine to use but now I want to escape the XML string and I found there is a XMLFormatter class used for that, after I dig into the doc, I see it is really hard to use from the constructor perspective. What I want is just 2 functions:
string escape(string);
string unescape(string);
why xerces mak...
I'm using a QTableView with a subclass of QItemDelegate to control the look and feel of the tableview's cells.
Each cell displays the name and status of a of an externally connected device, and as many as 100 devices may be connected at once.
The name and type of each device is essentially static, updating very rarely (perhaps once an ...
Is there any good tool to generate java (+JNI support if needed) from a header file so that a C or C++ library can be used as-is. Kind of a reverse of javah. The real functionality would be in the C/C++, the Java would be only a shim on top for certain users.
I'm no expert on JNI but as far as I can see Javah forces you to do this back...
I've heard the term "memory fragmentation" used a few times in the context of C++ dynamic memory allocation. I've found some questions about how to deal with memory fragmentation, but can't find a direct question that deals with it itself. So:
What is memory fragmentation?
How can I tell if memory fragmentation is a problem for my ap...
Is it posible to use the type of a prefiously declared function as a function pointer without using a typedef?
function declaration:
int myfunc(float);
use the function declaration by some syntax as function pointer
myfunc* ptrWithSameTypeAsMyFunc = 0;
...
Hello!
Is there any fast way to determine if some arbitrary image file is a png file or a jpeg file or none of them?
I'm pretty sure there is some way and these files probably have some sort of their own signatures and there should be some way to distinguish them.
If possible, could you also provide the names of the corresponding rout...
I'm working on implementing a Factory class along the lines of what is proposed in this response to a previous question:
http://stackoverflow.com/questions/410823/factory-method-implementation-c/534396#534396
It's a Factory that stores a map from strings to object creation functions so I can request different types of objects from the ...
What is the overhead in the string structure that causes sizeof() to be 32 ?
...
I'm using a type Id which is defined in another part of the code I'm using:
typedef int Id;
Now I am provided many objects, each of which comes with such an Id, and I would like to use the Id as index into a std::vector that stores these objects. It may look something like this:
std::vector<SomeObj*> vec(size);
std::pair<Id, SomeObj*...
Hi!
I'm looking for a simple c/c++ lib that would allow to extract the first frame of a video as a uchar array. And have a simple fonction to access the next one.
I know of FFMPEG but it requiere to play with packet and things like that, and i'm surprised that nowhere on the net i can find a lib that allow something like :
Video v = o...
I have a windows C++ application (mingw, but I guess it doesn't matter). I need to do very occasional obscure types of DNS lookups, such as TXT and AXFR.
The best I can do at the moment is using gethostbyname in winsock, but that doesn't support the above types :(. Does anyone know of a nice library that runs on win32 for DNS lookups?
...
By trying to solve this problem, something made me wonder. Consider the following code:
template <typename T>
struct foo
{
foo(T const& x) : data(x) {}
T data;
};
It seems that I can construct an object of type foo<T const&> without error, the hypothetical T const& const& being understood as T const&.
It seems also that this...