Hi folks,
I have next situation: I need to create widget in standalone static library, which then will be linked with final application (visual c++ 9.0, qt 4.5).
This static widget library contains some resources (icons), and consist of a several .cpp files (each contains standalone widget). As far as I know, i must initialize qt resour...
I have a method which looks like this:
template <typename T>
T Test<T>::FindItem(T item)
{
if(found)
//return original value, no problem here
else
//I want to return NULL here, like:
return NULL;
}
This fails in certain cases at runtime because some of the values can't be converted to NULL in C++ e.g.,...
Looking for Win32 API functions, C++ or Delphi sample code that tells me the CPU usage (percent and/or total CPU time) of a thread (not the total for a process). I have the thread ID.
I know that Sysinternals Process Explorer can display this information, but I need this information inside my program.
...
I'd like to use boost.pool. It's okay if you don't know about it. Basically, it has two main functions, malloc() and free().
I've overloaded new and delete for my custom defined class test.
class test
{
public:
test()
{
cout << "ctor" << endl;
}
~test()
{
cout << "dtor" << endl;
}
vo...
I am currently reading Stroustrup's book "Design and Evolution of C++" and it turns out that he was not the one who developed C++. When I hear someone saying "Bjarne Stroustrup developed C++ blah-blah-blah", I always feel it is very unfair to these guys who worked with BS - I mean Jonathan Shopiro, Andrew Koenig, Stan Lippman, Stefan Dew...
Suppose I have code something like this:
#include "boost/thread/mutex.hpp"
using boost::mutex;
typedef mutex::scoped_lock lock;
mutex mut1, mut2;
void Func() {
// ...
}
void test_raiicomma_1() {
lock mut1_lock(mut1);
Func();
}
void test_raiicomma_2() {
(lock(mut1)), Func();
}
void test_raiicomma_3() {
(lock(mut1)), (lock(mut2...
I am a big fan of ctags Hence I am wondering if I have cscope, will I benefit more there two programs. Seems like the latter has the same features as ctags, namely, facilitating the finding of symbols.
What are the features scope offers that can further increase my productivity with VIM?
Thanks
...
How can I get the file owner's access permissions using stat from sys/stat.h using C++ in Kubuntu Linux?
Currently, I get the type of file like this:
struct stat results;
stat(filename, &results);
cout << "File type: ";
if (S_ISDIR(results.st_mode))
cout << "Directory";
else if (S_ISREG(results.st_mode))
cout << "...
Hi there ...
I am programming a an algorithm for a library and I didn't use function calls at all.
The algorithm is about 100 lines and there is no duplicate code.or should I use inlining ?
...
just want to know how to add an spin control ( in another name, up/down control ) in the dialog box using C program (win32 / code::block / mingw compiler)
...
I've read many discussions on the difference between references and pointers and when to use which. They all seem to get their conclusions from analysis of the behaviors of the two.
But I'd still like to know what was in the language designers' mind. What's the main motive for this design? In what typical situation is it intended to be ...
I just want to expand this following method into something more generic, which should accept any kind of argument and display it using MessageBox():
void alert(char *item)
{
MessageBox(NULL, item, "Message", MB_OK | MB_ICONINFORMATION);
}
Can anyone help?
...
Hello,
I have problem that,std::numeric_limits::min() conflicts with the "min" macro defined in "windef.h". Is there any way to resolve this conflict without undefine the "min" macro.
The link below gives some hints, however I couldn't manage to use parenthesis with a static member function.
What are some tricks I can use with macros?...
Just the other day I have seen code that uses the so called singleton pattern. Meaning something along the lines of
class MySingleton{
public:
void foo() { ... }
static MySingleton
return singleton
}
private:
MySingleton(){ ... }
~MySingleton(){ ... }
int bar;
};
I do see why one would want to do that:
...
Please consider the three functions.
std::string get_a_string()
{
return "hello";
}
std::string get_a_string1()
{
return std::string("hello");
}
std::string get_a_string2()
{
std::string str("hello");
return str;
}
Will RVO be applied in all the three cases?
Is it OK to return a temporary like in the above code? I ...
Is there any published benchmark results about RegEx performance in .NET vs. unmanaged C++/C?
...
Imagine you're free to choose a tool like GNU make for a new C++ project. What would you choose? Are any usable substitutes out there?
It shall have/be
a command line interface
"easy" to understand ;)
easy to set up for a default c++ project
may support src/bin seperation as common for Java
may not add too much dependencies to other s...
CreateL()
{
_LIT(KSQLCountry, "CREATE TABLE Country(CountryID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,CountryName VARCHAR(45) NOT NULL,CountryCode VARCHAR(10) NOT NULL)");
User::LeaveIfError(iDatabase.Execute(KSQLCountry));
}
while creating table i want to declare for primary key and foreign key
which showing run time error (it cr...
In one of the answers to this question jalf spoke about useful define NOMINMAX, that could prevent from unwanted defining min/max macros. Are there other useful defines that can help to control windows.h (or other Windows headers, for instance Microsoft C Runtime headers or STL implementation) behavior?
...
Hello, I have been working on learning C++ and Qt4 recently, but I have hit a stumbling block.
I have the following class and implementation:
class Window : public QWidget
{
public:
Window();
public slots:
void run();
private:
//...
};
and
Window::Window()
{
//...
connect(runBtn,SIGNAL(clicked()),this,SLOT(run...