#include<iostream>
using namespace std;
class TCSGraph{
public:
void addVertex(int vertex);
void display();
TCSGraph(){
head = NULL;
}
~TCSGraph();
private:
struct ListNode
{
string name;
struct ListNode *next;
};
List...
Hi,
I'm asking about the best practice widely used in C++ projects. I need to have my own types in the project. It's a collection of couple of typedefs.
Is including header file containing the types good practice in C++ or is it better to use namespaces. If so, why? What are the pros and cons of the two ways?
Right now it looks like ...
Hi all, I'm working on a graphical application which looks something like this:
while (Simulator.simulating)
{
Simulator.update();
InputManager.processInput();
VideoManager.draw();
}
I do this several times a second, and in the vast majority of cases my computation will be taking up 90 - 99% of my processing time. What I w...
Hi,
I am developing a c/c++ program on linux. Can you please tell me if there is any c/c++ library which decodes url?
I am looking for libraries which
convert
"http%3A%2F%2F"
to:
"http://"
or
"a+t+%26+t" to "a t & t"
Thank you.
...
hi , i have a compiler project and i want to print the ast after the compile complete
so can i print this ast to qt (on c++) panel using graphviz ?
note : i dont know if there is a binding between qt or c++ and graphviz , so if it doesnt work please help me to find the alternative .
thanks .
...
Im trying to change from big endian to little endian on a double. One way to go is to use
double val, tmp = 5.55;
((unsigned int *)&val)[0] = ntohl(((unsigned int *)&tmp)[1]);
((unsigned int *)&val)[1] = ntohl(((unsigned int *)&tmp)[0]);
But then I get a warning: "dereferencing type-punned pointer will break strict-aliasing rules" an...
I've got a function that requires const some_type** as an argument (some_type is a struct, and the function needs a pointer to an array of this type). I declared a local variable of type some_type*, and initialized it. Then I call the function as f(&some_array), and the compiler (gcc) says:
error: invalid conversion from ‘some_type**’ t...
Hi,
As a common rule, it is very often considered a bad practice to use const_cast<>() in C++ code as it reveals (most of the time) a flaw in the design.
While I totally agree with this, I however wonder what are the cases were using const_cast<>() is ok and the only solution.
Could you guys please give me some examples you know/you e...
I'm writing small program. Program use data from other software. That other software keep data in Sysbase SQL db. To keep my data I'm using SQLite. ATM it looks like that: I read data from SysbaseSQL (id, art_id, name, ...) and then I write data to sqlite (id, art_id, amount).
When I show data, I read from Sysbase (id, art_id, name, ..) ...
I'm trying to create a simple date class, but I get an error on my main file that says, "call of overloaded Date() is ambiguous." I'm not sure why since I thought as long as I had different parameters for my constructor, I was ok. Here is my code:
header file:
#ifndef DATE_H
#define DATE_H
using std::string;
class Date
{
public:
...
Hi,
Meaning the C10K problem, what is the best way to do asynch I/O on Mac OS X (assume to use on Mac and iPhone/iPad)?
On Linux our choice is epoll, on Windows is I/O Completion Ports.
Top priority is performance and scalability (thousands of connections).
UPDATE
OK. As Darwin is BSD-like system, my common idea is to use kqueue. Is...
Hi: In an iPhone application I use a library(C++) which asynchronously makes a callback when computation is finished.
Now I want to measure the time which is spent -including the method which calls the library- until the callback is made. Are there any possibilities to do this with the Instruments application from Apple? What are the be...
I am using SWIG to pass numpy arrays from Python to C++ code:
%include "numpy.i"
%init %{
import_array();
%}
%apply (float* INPLACE_ARRAY1, int DIM1) {(float* data, int n)};
class Class
{
public:
void test(float* data, int n)
{
//...
}
};
and in Python:
c = Class()
a = zeros(5)
c.test(a)
This works, but how can I pa...
There are several ways to list serial ports under Windows but I'm not sure what is the proper way: the way that does detect all serial ports that are available.
One good code example is http://www.naughter.com/enumser.html - where there are 9 (nine!) ways of enumerating serial devices.
The question is: what is the optimal way of doing ...
I am using Artistic Style version 1.24(http://astyle.sourceforge.net/) for indenting the C++ program but while indentation,it crosses the column 78.Does it contain any option to prevent this?
...
Hi
I am using CreateProcess() to run an external console application in Windows from my GUI application. I would like to somehow gather the output to know whether there were errors. Now I know I have to do something with hStdOutput, but I fail to understand what. I am new to c++ and an inexperienced programmer and I actually don't kn...
Hi, I want to create my C++ libraries with Unicode support so they can be reused on other platforms. I have found the ICU (International Components for Unicode) project but I also found a discuss about Apple rejecting for using ICU (see http://tinyurl.com/y86phfb). So how do you guys use Unicode in C++ on iPhone? Thanks.
...
Hey,
I'm currently searching for a portable way of getting the local IP-addresses. Because I'm using Boost anyway I thought it would be a good idea to use Boost.Asio for this task.
There are serveral examples on the net which should do the trick. Examples:
Official Boost.Asio Documentation
Some Asian Page
I tried both codes with jus...
What is the name of that kind of structure?
Or where can I read about that.
class A : public B < A > { ... }
...
why does
void operator<<(ostream out, Test &t);
return an error whereas
void operator<<(ostream &out, Test &t);
does not ?
...