c++

GCC ICE -- alternative function syntax, variadic templates and tuples

(Related to C++0x, How do I expand a tuple into variadic template function arguments?.) The following code (see below) is taken from this discussion. The objective is to apply a function to a tuple. I simplified the template parameters and modified the code to allow for a return value of generic type. While the original code compiles...

What's the syntax difference between Symbian C++ and canonical C++?

It's said Symbian C++ has its own dialect, can someone list the exact aspect that differs? ...

C++ Beginner - 'friend' functions and << operator overloading: What is the proper way to overload an operator for a class?

Hello, everyone! In a project I'm working on, I have a Score class, defined below in score.h. I am trying to overload it so, when a << operation is performed on it, _points + " " + _name is returned. Here's what I tried to do: ostream & Score::operator<< (ostream & os, Score right) { os << right.getPoints() << " " << right.scoreGetN...

What is a good programming language for testers who are not great programmers?

We would like to create some simple automated tests that will be created and maintained by testers. Right now we have a tester who can code in any language, but in the future we might want any tester with a limited knowledge of programming to be able to add or modify the tests. What is a good programming language for testers who are not...

C++: How do I correctly register and unregister file type associations for our application (programatically)

Time was when you set file associations in: HEY_CLASSES_ROOT\<.ext> However, that seems to be possible, but an incomplete solution anymore. There are additional associations throughout the registry. For example: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap HKEY_LOCAL_MACHINE\Software\Microsoft\Window...

How to pass a multidimensional array to a function in C and C++

#include<stdio.h> void print(int *arr[], int s1, int s2) { int i, j; for(i = 0; i<s1; i++) for(j = 0; j<s2; j++) printf("%d, ", *((arr+i)+j)); } int main() { int a[4][4] = {{0}}; print(a,4,4); } This works in C, but not in C++. error: cannot convert `int (*)[4]' to `int**' for argument `1' to `vo...

C++: warning: '...' declared with greater visibility than the type of its field '...::<anonymous>'

I'm getting these two warnings (with GCC 4.2 on MacOSX): /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154:0 /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154: warning: 'startMainLockDetector()::MainLockDetector' declared with greater visibility than the type of its field 'startMainLockDetector(...

Getting the compiler to perceive << as defined for a specific class

Hello everyone. I edited a post of mine with this question, yet got no answers. I overloaded << for a class, Score (defined in score.h), in score.cpp. ostream& operator<< (ostream & os, const Score & right) { os << right.getPoints() << " " << right.scoreGetName(); return os; } (getPoints fetches an int attribute, getName a string ...

Should this work?

I am trying to specialize a metafunction upon a type that has a function pointer as one of its parameters. The code compiles just fine but it will simply not match the type. #include <iostream> #include <boost/mpl/bool.hpp> #include <boost/mpl/identity.hpp> template < typename CONT, typename NAME, typename TYPE, TYPE (CONT::*getter)()...

What is purpose of a "this" pointer in C++ ?

What is purpose of this keyword. Doesn't the methods in a class have access to other peer members in the same class ? What is the need to call a this to call peer methods inside a class? ...

Boost Multithreading

Can anyone tell what's going on here? When I try debug the code and when the control is in thread() function at Line 15, it skips over the Line 16 move to Line 17 and goes back Line 16. Why wouldn't it move Line by Line? 1. #include <boost/thread.hpp> 2. #include <iostream> 3. 4. void wait(int seconds) 5. { 6. boost::this_thread::...

custom C++ boost::lambda expression help

hello. A little bit of background: I have some strange multiple nested loops which I converted to flat work queue (basically collapse single index loops to single multi-index loop). right now each loop is hand coded. I am trying to generalized approach to work with any bounds using lambda expressions: For example: // RANGE(i,I,N) is ...

Can anybody explain to the meaning of this expression ??

void* GetData() { return reinterpret_cast<unsigned char*>(this); } Is there a case of automatic type coercion happening in this case ??? How could I convert the object of my class to an unsigned char* ?? ...

Documentation for Twitter API using OAuth for C++

So i am upgrading our service to go to the new OAuth security measures. Using a single twitter account to send Direct Messages to users for an alert. I wrote up a quick app that retrieved the access token and secret using the Java library. But the kicker is that i need to send these messages via C++. and a Javascript file. (this is curre...

Debugging C++ Templates in Linux/TotalView.

Debugging code in TotalView. Can not step into local templatized code (STL code can be stepped into). Looking for the correct flags/mechanism that is missing so that I can enable debugging for my templatized code. ...

Help with enum values in registry c++

DWORD type = REG_NONE; int i = 0; size = sizeof(ValueName); size2 = sizeof(ValueData); BOOL bContinue = TRUE; do { lRet = RegEnumValue(Hkey , i , ValueName , &size , 0 , &type , ValueData , &size2); switch(lRet) { case ERROR_SUCCESS: print_values(ValueName , type , ValueData , size2); i++; size = sizeof(ValueName...

Why only random-access-iterator implements operator+ in C++?

I'd like get far next value for STL list iterator but it doesn't implement operator+, vector has it though. Why and how can I get the value where I want? I think I can do that if I call operator++ several times, but isn't that a little bit dirty? What I want to do is the following: list<int> l; ...omitted... list<int>::iterator itr = ...

upgrading boost version

I'm using RHEL 5.3, shipped with gcc 4.1.2 and boost 1.33. So, there's no boost::unorded_map, no make_shared() factory function to create boost::shared_ptr and other features available in newer releases of boost. Is there're a newer version of boost compatible with the version of gcc? If yes, how the upgrade is performed? ...

inheriting from a class declarations in c++

When you want to inherit from a class in C++, is it illegal to have std declared in the first line below? #ifndef HWEXCEPTION_H #define HWEXCEPTION_H #include <stdexcept> class HWException : public std::run_time_error { void testException(int num); }; #endif vs using std::run_time_error class MyClass : public run_time_error ...

a problem in socks.h

i use this (http://www.codeproject.com/KB/IP/Socks.aspx) lib in my socket programing in c++ and copy the socks.h in include folder and write this code: #include <windows.h> #include <winsock.h> #include <stdio.h> #include <conio.h> #include <process.h> #include "socks.h" #define PORT 1001 // the port client wil...