Since static const data inside a class is really just namespace sugar for constants I would think that
struct A {
float a;
struct B {
static const int b = 2;
};
};
would be equivalent to
struct A {
float a;
};
struct A::B {
static const int b = 2;
};
or something similar. Is something like this possi...
I am using the latest version of boost and boost.asio.
I have this class:
enum IPVersion
{
IPv4,
IPv6
};
template <IPVersion version = IPv4>
class Connection
{
private:
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver;
boost::asio::ip::tcp::resolver::query query;
boost::asio::ip::tcp...
I have the following chunk of a header file BKE_mesh.h:
/* Connectivity data */
typedef struct IndexNode {
struct IndexNode *next, *prev;
int index;
} IndexNode;
void create_vert_face_map(ListBase **map, IndexNode **mem, const struct MFace *mface,
const int totvert, const int totface);
void create_vert_edge_map(ListBas...
I'm considering to use C++0x threads in my application instead of Boost threads. However, I'm not sure how to reimplement what I have with standard C++0x threads since they don't seem to have an interrupt() method.
My current setup is:
a master thread that manages work;
several worker threads that carry out master's commands.
Worke...
I have a working c++ dll that works in one c# project that I am calling via the interop service. I have created another c# project and am trying to call the same .dll but keep getting a generic error message stating that the .dll cannot be found, both project are .net 2.0. What folder, and where do I specify in the project, should I pu...
I have a program which draws some terrain and simulates water flowing over it (in a cheap and easy way).
Updating the water was easy to parallelize using OpenMP, so I can do ~50 updates per second. The problem is that even with a small amounts of water, my draws per second are very very low (starts at 5 and drops to around 2 once there'...
I'm using Code::Blocks to write my program and when I include <string> (or <iostream>) the size of my exe grows. My program is very simple and I need to keep it small <20kb. I'm pretty sure this is happening because of the C++ Standards Committee swapped the old .h versions for many new libraries without the .h. But how would I keep it f...
what is the C++ equivilant to the c function fgets?
I have looked at getline from ifstream, but when it comes to a end of line character, '\n', it terminates at and discards it, I am looking for a function that just terminates at the end line character but adds the end of line character to the char array.
thanks in advance
...
I am trying to use sho to show the output of another function.The first function was used to do sorting, and returned a List.
now I want to make a function that uses show() to display the output.This is how I had tried it only to get an error.
Its to diplay the results of two the two sorted lists which used this function.
//Functi...
I was reading this: http://en.wikipedia.org/wiki/Thread_safety
Is the following function thread-safe?
void foo(int y){
int * x = new int[50];
/*...do some stuff with the allocated memory...*/
delete [] x;
}
In the article it says that to be thread-safe you can only use variables from the stack. Really? Why? Wouldn't subse...
I am writing a small tool for analyzing simple B Machine substitutions as part of a college research work. The code successfully parse test inputs of the form mySubst := var1 + var2. However, I get a pop-up error message saying "This application has requested the Runtime to terminate it in an unusual way. " In the command prompt window, ...
hello.
I wrote this generator, and I think to submit to boost people.
Can you give me some feedback about it?
It basically allows to collapse multidimensional loops to flat multi-index queue. Loop can be boost lambda expressions. Main reason for doing this is to make parallel loops easier and separate algorithm from controlling struct...
I'm trying to compile some Microsoft SAPI example code in a non-Microsoft C++ Compiler, and am getting an error at this line:
_HFILE m_hfilePrev;
Presumably because it doesn't recognize the _HFILE #define. Does anybody know what .h file I should include for that?
...
I have a simple small question which someone who knows will be able to answer easily, I searched google but couldn't find the answer.
There are many programs running at once on a computer, and my question is: when a program loads a DLL, does it actually load the DLL file or does it find the memory in which the DLL is already loaded? For...
ok i have this program working using c-strings. I am wondering if it is possible to read in blocks of unformatted text to a std::string? I toyed arround with if >> but this reads in line by line. I've been breaking my code and banging my head against the wall trying to use std::string, so I thought it was time to enlist the experts. ...
Hi,
Is there any free memory leak detection tool for QT programs to run on windows? I am using QtCreator as my IDE. If any plugin or add-on is available with QtCreator its best also.
Has anybody any idea about this?
...
In these days i'm playing with the C functions of atol(), atof() and atoi(), from a blog post i find a tutorial and applied:
here are my results:
void main()
char a[10],b[10];
puts("Enter the value of a");
gets(a);
puts("Enter the value of b");
gets(b);
printf("%s+%s=%ld and %s-%s=%ld",a,b,(atol(a)+atol(b)),a,b,(atol(a)-atol(b)));
ge...
Hi,
I recently began setting up my own library and projects using a cross platform build system (generates make files, visual studio solutions/projects etc on demand) and I have run into a problem that has likely been solved already.
The issue that I have run into is this: When an application has a dependency that also has dependencies...
I have an array like this:
int a[100];
I am filling only the first 4 elements in this array:
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4;
When I do sizeof(a)/sizeof(a[0]) it returns 100.
Is there a way I can get number of elements to which I have assinged a value and thus filtering out the remaining 96 unassigned elements?
thanks
...
Does anyone know the location of a good list or tutorial showing all the compiler macros (_T etc) in use in Visual Studio 2008?
Thanks in advance
...