Here is some code outlining a problem I've been wrestling with. The final problem (as far as g++ is concerned at the moment) is that: "error: 'Foo-T' was not declared in this scope" when performing the Bar::Bar(...) constructor routine. Otherwise, the problem I'm attempting to learn my way through is one of setting base-class member type...
What is the difference between function template and template function?
...
I am using a named pipe for communications between two processes and want to restrict acess to any user on the local system in Windows.
I am building up and ACL for use in the SECURITY_ATTRIBUTES passed to CreateNamedPipe.
I am basing this code on that from Microsoft.
SID_IDENTIFIER_AUTHORITY siaLocal = SECURITY_LOCAL_SID_AUTHORITY;
i...
I have a dialog created from a template. It has controls listed in the template in the following order:
some irrelevant controls
a label with an accelerator (let's pretend it's Alt-A)
an edit box
OK and Cancel buttons
Normally when I hit Alt-A the keybord focus is transferred to the edit box - just as needed. However I sometimes need...
Is there any difference between pointer to const and usual pointer for functions? When it is suitable to use const qualifier for stand alone functions?
I wrote short sample to illustrate my question:
#include <iostream>
using namespace std;
int sum( int x, int y ) { return x + y; }
typedef int sum_func( int, int );
int main()
{
c...
Trying to use the RHEL5.3 GCC 4.3.2 compiler to build my software on that platform. I get the following error no matter what I try when compiling with -O2, but it builds fine without optimization. Any ideas?
/usr/bin/ld: myapp: hidden symbol `void std::__ostream_fill<char, std::char_traits<char> >(std::basic_ostream<char, std::char_tr...
I'm working on a plugin for a smaller application using gtkmm. The plugin I'm working on checks certain conditions (the date had changed and a new day started) after every minute and starts some actions if the conditions are true. In the initialization part of the plugin I have the following piece of code that uses Glib::SignalTimeout an...
Hi,
i use incredibuild for parallel compiling...
i also need parallel linking but i couldnt manage it for linking.
do you know is it possible to make it parallel?
if there is a way, could you tell me?
if not, do you know any other tools for this purpose?
i have too many projects and i need to link them on seperate machines..
...
I am looking for a database library that can be used within an editor to replace a custom document format. In my case the document would contain a functional program.
I want application data to be persistent even while editing, so that when the program crashes, no data is lost. I know that all databases offer that.
On top of that, I wa...
Hej!
I am looking for a portable way of periodically dispatching a task in a C++ project. The use of libraries such as boost should be avoided in this particular project.
The resolution requirement is not too serious: between 5Hz to 20Hz on an average Netbook.
The project uses OpenGL to render the HMI but since I am working on the bac...
Hi,
I'm trying to use the C++ STD TechnicalReport1 extensions to generate numbers following a normal distributions, but this code (adapted from this article):
mt19937 eng;
eng.seed(SEED);
normal_distribution<double> dist;
// XXX if I use the one below it exits the for loop
// uniform_int<int> dist(1, 52);
for (unsigned int i = 0;...
I recently came across some weird looking class that had three constructors:
class Class
{
public:
explicit Class(int );
Class(AnotherClass );
explicit Class(YetAnotherClass, AnotherClass );
// ...
}
This doesn't really make sense to me - I thought the explicit keyword is to protect compiler chosen c...
Before this is marked as duplicate, I'm aware of this question, but in my case we are talking about const containers.
I have 2 classes:
class Base { };
class Derived : public Base { };
And a function:
void register_objects(const std::set<Base*> &objects) {}
I would like to invoke this function as:
std::set<Derived*> objs;
registe...
Hi there
I am writing a library, which is dynamically loaded in my main-application with dlsym.
I have the following files:
library.h
#include <ilibrary.h>
#include <igateway.h>
class LibraryImpl;
class Library: public ILibrary {
public:
static ILibrary* instance();
IGateway* getGateway() const;
protected:
Library();
...
Consider the following class:
class Person {
public:
// I don't want any "char *" to be converted to Person implicitly!
explicit Person( const char * name ) : name_(name) {};
private:
std::string name_;
};
Also consider following array of char* data:
char STUDENT_NAMES[][20] = {
"Bart",
"Liza",
"Maggie"
};
...
Hi,
I am curious to know about the in details about how the malloc and free works.
int main()
{
unsigned char *p = (unsigned char*)malloc(4*sizeof(unsigned char));
memset(p,0,4);
strcpy((char*)p,"abcdabcd"); // **deliberately storing 8bytes**
cout << p;
free(p); // Obvious Crash, but I need how it works and why cra...
I have an app that collects Perfmon counter values through the API exposed in winreg.h - in order to collect Perfmon counter values I must make a call to RegQueryValueExW passing in the id of the Perfmon counter I'm interested in, and in order to obtain that ID I need to query the registry for the list of Perfmon counter names and go thr...
Hey all,
I'm writing a small library in C++ that I need to be able to build on quite a few different platforms, including iPhone, Windows, Linux, Mac and Symbian S60. I've written most of the code so that it is platform-agnostic but there are some portions that must be written on a per-platform basis.
Currently I accomplish this by...
I see variables defined with this type but I don't know where it comes from, nor what is its purpose. Why not use int or unsigned int? (What about other "similar" types? Void_t, etc).
...
I've got a conversion operator that returns a const pointer, and I need to const_cast it. However, that doesn't work, at least under MSVC8. The following code reproduces my problem:
class MyClass {
public:
operator const int* () {
return 0;
}
};
int main() {
MyClass obj;
int* myPtr;
// compiles
const int...