I can forward declare a function in a namespace by doing this:
void myNamespace::doThing();
which is equivalent to:
namespace myNamespace
{
void doThing();
}
To forward declare a class in a namespace:
namespace myNamespace
{
class myClass;
}
Is there a shorter way to do this? I was thinking something along the lines of:
cl...
I'm trying to compile a bundle that uses a third party library. I've had this working a while ago, but now it just refuses to link. Here's a sample of the errors:
"lwpp::GlobalBase<char const* ()(char const*)>::globPtr", referenced from:
__ZN4lwpp10GlobalBaseIFPKcS2_EE7globPtrE$non_lazy_ptr in main.o
__ZN4lwpp10GlobalBaseIFPKcS2_E...
Hi Everyone
I'm trying to make a boost::multi_index container that uses member functions w/ parameters as keys.
class Data {
public:
std::string get(const std::string & _attr) { return _internals_fetch_data(_attr); }
/*
assume some implementation for storing data in some structure(s)
*/
};
Suppose I have a rectangular list of ...
So, I'm working on translating my C++ app into multiple languages. What I'm currently using is something like:
#define TR(x) (lookupTranslatedString( currentLocale(), x ))
wcout << TR(L"This phrase is in English") << endl;
The translations are from a CSV file which maps the english string to the translated string.
"This phrase is in...
I`m writing STL-like container for binary-search tree. I have template class for Tree itself and nested class TreeNode.
My question is where should I put the binary-predicate function which compairing keys - Into the tree class or into the Node class? If I decide to put it in a Tree class, all of my nodes would not know how to compare t...
I have a QTableView using a QSqlTableModel.
In the underlying database (postgresql) table there is a timestamp column.
How can I select all rows in the selection model where the underlying timestamp column is NULL?
Pointers in the right direction would help.
UPDATE:
The main issue I have been having is performance. Each method I ha...
Hi
I am creating a simple C++ program to ask user for fahrenheit in main thread and then convert this value to Celsius in another thread.
But i continue to get one error . This error keeps
visual studio 2008\projects\cs1\cs1\cs1.cpp(16) : error C2143: syntax error : missing ';' before '='
This problem sometimes disappears but inste...
Hello,
Does anyone have a smal example of how to programmatically, in c/c++, load a users registry hive? I would loike to load a hive set some values and close the hive.
Thanks in advance for any help.
Tony
...
First, I'd like to note that I need to use the COM/OLE2 APIs, the low level stuff, the stuff you can put in a C Windows Console program. I can't use MFC. I can't use .NET.
My question is:
Given the following code:
CLSID clsid;
HRESULT hr;
hr = CLSIDFromProgID(L"InternetExplorer.Application", &clsid);
assert(SUCCEEDED(hr));
hr ...
I want to install a SIGSEGV and friends handler in C++ to print a stack trace and exit on a crash.
backtrace_symbols_fd from glibc is almost what I want, but it doesn't symbolize calls in anonymous namespaces. However, gdb deals with that just fine (I have symbols compiled in, DWARF etc).
What library would you recommend for my situati...
I'm working on a C++ project in which there are a lot of classes that have classes, methods and includes all in a single file. This is a big problem, because frequently the method implementations require #include statements, and any file that wants to use a class inherits these #includes transitively. I was just thinking that it would be...
Disclaimer: I am aware that there are two questions about the usefulness of const-correctness, however, none discussed how const-correctness is necessary in C++ as opposed to other programming languages. Also, I am not satisfied with the answers provided to these questions.
I've used a few programming languages now, and one thing that b...
I have often seen the spinning gears OpenGL example ( I think originally done by SGI) but I today I have only been able to find C and Ruby implementations, can anyone point me to a c++ implementation?
...
I'm trying to make a simple game engine. I've never used OOP before, so this is probably a simple mistake, but I get this error when trying to create an instance of a class.
invalid conversion from `World*' to `int'
initializing argument 1 of `World::World(int)'
This is the code to create the class.
World w = new World(100);
And ...
Is there a way of printing arrays in C++?
I'm trying to make a function that reverses a user-input array and then prints it out. I tried Googling this problem and it seemed like C++ can't print arrays. That can't be true can it?
...
I am looking for an open source C/C++ image/video thumbnail generation libraries.
(other than ffmpeg or DevIL)
...
I need to implement extract min for heap(in c++ if possible), could not get this method from STL heap.
...
I have a c++ unmanaged project whose output is an .xll file which is an add-in loaded by excel at startup, this add-in can work with both versions, excel 2003 and excel 2007.
Now, what I need to do is to obtain the version of the excel instance that the user is actually using for working with my add-in.
Does anyone can suggest me how t...
I am using g++. I am using code that had a main(int,char**), renamed so I can call it. I looked at http://stackoverflow.com/questions/779910/should-i-use-char-argv-or-char-argv-in-c, where char** is said to be equivalent to char* []. This does not appear to be true in c++ function calls. For example:
void f1(char** p){;}
void f2(ch...
Looking at example under "Pointers to classes" (very bottom)
How is it that we can use the dot operatior here:
CRectangle * d = new CRectangle[2];
...
d[1].set_values (7,8);
if d is a pointer?
Same question for the lines:
cout << "d[0] area: " << d[0].area() << endl;
cout << "d[1] area: " << d[1].area() << endl;
Also, For...