Say you have a vector class that has a template length and type - i.e. vec<2,float>. These can also be nested - vec<2,vec<2,vec<2,float> > >, or vec<2,vec<2,float> >. You can calculate how deeply nested one of these vectors is like this:
template<typename T>
inline int depth(const T& t) { return 0; }
template<int N, typename T>
inline ...
Is it possible to produce gcov data files (.gcda files) by running an executable linked to a shared library built with the --coverage option?
Basically, I have the main library consisting of multiple c++ files compiled into one shared library and then a subdirectory called "test" containing a test program that links to and tests the mai...
I calculated time elapsed in my function in VS and g++. I see a huge performance difference. I use unix time command to calculate time elapsed from my g++ compiled executable. I use clock function in main() to calculate time elapsed in VS. g++ is giving ~2 seconds whereas VS is giving 19 seconds which is a huge difference. Can this be ex...
As a programmer I use to follow TDD, beginning by writing a simple version of my code then heavily refactoring it. When refactoring I usually just listen to my code. I search for bad smells and then refactor the code to remove smells. Typically I will introduce new methods to avoid repeating code, move class members around to put them ne...
I am creating a C# winforms application targeting the .NET 3.5 framework. I want this program to be able to have plugins. Hopefully the plugins can be created in unmanaged C++. If there is no direct way to make a plugin in C++, then i would like the know the easiest plugin framework that would allow me to make a simple C# wrapper for ...
How do I get four threads to access to a data container (std::vector<unsigned int>) and add data to it by using my_vector.push_back() and suspend (or sleep) the thread when the size of my_vector reaches a certain size.
The access to the share resource is controlled by means of a mutex. This is all fine, but I can't get the size of the s...
I was looking for a C/C++ library with a function that would allow you to search for a tag by name and attributes, and then return other attributes of the found tag, and most importantly, indicate which visible character position the tag occurred at.
Does jquery/javascript already allow this, and if so, do I just need something to proce...
hey, i have overridden operator<< and when i'm trying to use it in a print method (const) i'm getting an error :
the overriden operator :
ostream& operator <<(ostream& os, Date& toPrint)
{
return os << toPrint.GetDay() << "/" << toPrint.GetMonth() << "/" << toPrint.GetYear();
}
where i'm trying to use it :
void TreatmentHistory...
I need to instansiate an object and add it to an array. This is what I currently have in a method:
Row r;
rows[count] = r;
The problem here is r is on the stack and being removed after the function exits. I quick fix is to make r static but that is bad right? What should I do? (Sorry, complete C++ noob).
Edit: Removing the deconstruc...
We're needing to write small fast code on the windows platform and I know that boost in some instances has header only implementations. These need to be small for a reason, so we've been careful not to use the std C++ libraries actually because of size.
My question is, does using boost asio or system also haul in the std C++ libraries ...
What is the proper way of moving a player in Box2D setting Player->ApplyForce() kind of feels like it lacks flexibility and control. What other ways might there be to do this?
Thanks
...
I'm using the Boost Graph Library to process an undirected graph, and declared my graph has
typedef property<vertex_index_t, int, property<vertex_name_t, string> > VertexProperty;
typedef adjacency_list<vecS, setS, undirectedS, VertexProperty > UndirectedGraph;
As you can see, the OutEdgeList is of the type std::set and I chose it b...
This is my current makefile.
CXX = g++
CXXFLAGS = -Wall -O3
LDFLAGS =
TARGET = testcpp
SRCS = main.cpp object.cpp foo.cpp
OBJS = $(SRCS:.cpp=.o)
DEPS = $(SRCS:.cpp=.d)
.PHONY: clean all
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $(TARGET)
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
%...
I have a dynamic array which will be updated from a different test system. I am havign hard time with syntax. Can someone please help me here?
Here is where I declare my vector
void TestSystem::Drive(U32 RunMode, U32 Options)
{ //U32 is unsigned 32 bit
U32 condition;
U32 i;
U8 k;
vector<U32> badDriveList(1,0);//initi...
Right now I have a class A that inherits from class B, and B does not have a default constructor. I am trying the create a constructor for A that has the exact same parameters for B's constructor, but I get:
error: no matching function for call to ‘B::B()’
note: candidates are: B::B(int)
How would I fix this error?
...
I'm trying something spooky here. I'm trying to write C++ programs, compiled with GNU's g++, but without a dependency on libstdc++ :) but it seems that I need that for even the most basic things need it.
A libstdc++ with a configurable feature set would be acceptable.
The command I use is
g++ -nodefaultlibs -fno-rtti -fno-exceptions -...
for some reason I cannot explain, every single item in the character array...is equal to the last item added to it...for example progArgs[0] through progArgs[size] contains the value of the last item.
I cannot figure out what I'm doing wrong for the life of me. Any suggestions?
int count = 0;
char *progArgs[commandList.size()]
for...
std::thread f()
{
void some_function(); // <- here
return std::thread(some_function);
}
std::thread g()
{
void some_other_function(int); // <- here
std::thread t(some_other_function,42);
return t;
}
...
What well known C/C++ libraries are out there that could allow one to implement servlets, or at least provide most of the essentials for dealing with HTTP/CGI protocols such as http headers, error codes, cookies, GET/POST etc.
So far I have only found CPPSERV.
EDIT: Looking for server side solutions.
...
I'm currently disable certain buttons by handling ON_UPDATE_COMMAND_UI and calling ->Enable( TRUE / FALSE ).
What would be the best way to completely hide the button instead?
I've tried using HideButton and that makes the button image invisible, but it still takes up space so there is a blank area between visible buttons.
Thanks.
...