I'm trying to write a fairly simple threaded application, but am new to boost's thread library. A simple test program I'm working on is:
#include <iostream>
#include <boost/thread.hpp>
int result = 0;
boost::mutex result_mutex;
boost::thread_group g;
void threaded_function(int i)
{
for(; i < 100000; ++i) {}
{
boost::mut...
Hello, i have a question. How can i make my widget fullscreen?
I've tried something like this:
void MainWindow::SetFullScreen()
{
// Make our window without panels
this->setWindowFlags( Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint );
// Resize refer to desktop
this->resize( QApplication::desktop()->size(...
If I have a map like this:
std::map<char, std::vector<char> > m;
m['A'].push_back('a');
m['A'].push_back('b');
m['A'].push_back('c');
m['B'].push_back('h');
m['B'].push_back('f');
How would I find and delete 'b'? Is this possible?
...
I have been looking all over the web for the simplest solution for this, and currently I have come across nothing that seems simple enough for my needs.
I am looking for a way to manipulate a matrix of pixels manually in C++, platform independent.
Does anyone know of a library that is simple to use that will help me obtain this?
...
Hi all,
Say I've got a class called "Base", and a class called "Derived" which is a subclass of Base and accesses protected methods and members of Base.
What I want to do now is make it so that no other classes can subclass Derived. In Java I can accomplish that by declaring the Derived class "final". Is there some C++ trick that can...
I have a set of numbers ~100, I wish to perform MC simulation on this set, the basic idea is I fully randomize the set, do some comparison/checks on the first ~20 values, store the result and repeat.
Now the actual comparison/check algorithm is extremely fast it actually completes in about 50 CPU cycles. With this in mind, and in order...
I am trying to Union two sets with map. I have two sets and would like to combine them into a third one. I get an error for this code in the push_back. Is there a way to do this?
map<char, vector<char> > numbers;
map<char, vector<char> >::iterator it;
numbers['E'].push_back('a');//set1
numbers['E'].push_back('b');
numbers['E'].push_ba...
I can see that almost all modern APIs are developed in the C language. There are reasons for that: processing speed, low level language, cross platform and so on.
Nowadays, I program in C++ because of its Object Orientation, the use of string, the STL but, mainly because it is a better C.
However when my C++ programs need to interact w...
I was reading the Wikipedia article on SFINAE and encountered following code sample:
struct Test
{
typedef int Type;
};
template < typename T >
void f( typename T::Type ) {} // definition #1
template < typename T >
void f( T ) {} // definition #2
void foo()
{
f< Test > ( 10 ); //call #1
f< int > ( 10 )...
In C++, why is private the default visibility for members of classes, but public for structs?
...
Is it possible to incrementally increase the amount of allocated memory on a free store that a pointer points to? For example, I know that this is possible.
char* p = new char; // allocates one char to free store
char* p = new char[10]; // allocates 10 chars to free store
but what if I wanted to do something like increase the amount o...
Hello everyone... I'm looking into developing an application that will process data from a line-scan camera at around 2000 lines (frames) per second. For this real-time application, I feel that C/C++ are the way to go. (It is my feeling, and others will agree that Managed code just isn't right for this task.)
However, I've done very ...
Hi,
Exist any Way to Determine the Version of Firebird SQL is running? using SQL or code (delphi, C++).
Bye
...
I have a linking problem with MinGW. These are the calls:
g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows
-o debug/Simulation.exe debug/LTNetSender.o debug/main.o debug/simulation.o
debug/moc_simulation.o -L'c:/Programmieren/Qt/4.5.2/lib' -lmingw32
...
I'm not sure if my understanding of C++ is wrong.. I've read that 1) all non-zero values are equivalent to TRUE, and zero is equivalent to FALSE; 2) null pointers are stored as zero.
Yet code like this:
void ViewCell::swapTiles (ViewCell *vc) {
ViewTile *tmp = vc->tile();
[stuff ...]
if (tmp) addTile(tmp);
}
Gives me a se...
Hello. I have this generic string to number conversion :
enum STRING_BASE : signed int {
BINARY = -1,
OCTAL = 0,
DECIMAL = 1,
HEX = 2,
};
template <class Class>
static bool fromString(Class& t, const std::string& str, STRING_BASE base = DECIMAL) {
if (base == BINARY) {
t = (std::bitset<(sizeof(unsigned long)*8)>(str...
I'm interested in algorithm which I should use to meet these requirements (topic subj).
...
A lot of People see similarities between Java and C++ .
But when it comes to web development JavaEE is beeing used. Whereas C++ has little support on that?
C++ is fast.
So why it isn't used in web developement?
...
I have a class called MODEL in which public static int theMaxFrames resides. The class is defined in its own header file. theMaxFrames is accessed by a class within the MODEL class and by one function, void set_up(), which is also in the MODEL class. The Render.cpp source file contains a function which calls a function in the Direct3D.cp...
Hello :)
I'm getting started with Boost::Test driven development (in C++), and I'm retrofitting one of my older projects with Unit Tests. My question is -- where do I add the unit test code? The syntax for the tests themselves seems really simple according to Boost::Test's documentation, but I'm confused as to how I tell the compiler to...