c++

What is the best implementation of STL for VS2005?

I'm currently using default implementation of STL for VS2005 and I'm not really satisfied with it. Perhaps there is something better? ...

Class design with vector as a private/public member ?

what is the best way to put a container class or a some other class inside a class as private or a public member? Requirements: 1.Vector< someclass> inside my class 2.Add and count of vector is needed interface ...

Calling a static member function of a C++ STL container's value_type

Hi, I'm trying to get my head around why the following doesn't work. I have a std::vector and I want to call a static member function of it's contained value_type like so: std::vector<Vector> v; unsigned u = v.value_type::Dim(); where Vector is in fact a typedef for a templated type: template <typename T, unsigned U> class SVector; ...

Visual c++ "for each" portability

I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports for each syntax on stl lists et al to facilitate iteration. For example: list<Object> myList; for each (Object o in myList) { o.foo(); } I was very happy to discover it, but I'm concerned about portability for the dreaded day when ...

How do I create a symlink in Windows Vista?

I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the link? Pointers to some good documentation on this subject would be very much appreci...

What is the difference between "VC++" and "C++" ?

Someone asked me how familiar I am with VC++ and how familiar I am with C++. What is the difference? ...

Does ATL/WTL still require the use of a global _Module variable?

I'm just starting up a new ATL/WTL project and I was wondering if the global _Module variable is still required? Back a few years when I started working with WTL it was required (at least for ATL 3.0) that you define a global variable such as: CAppModule _Module; To get ATL to work correctly. But recently I've read somewhere that th...

How to use Data Access Objects for serialized & relational database data access

Hi all, I am developing a C++ domain model class library which should provide some facilities or a framework (i.e. interface classes etc) for writing/reading class instance data to/from both a binary file and a RDBMS. The basis for this library is an application that uses a RDBMS, and there are several methods which instantiate a class ...

Turning C# methods into C++ methods

I'm exploring various options for mapping common C# code constructs to C++ CUDA code for running on a GPU. The structure of the system is as follows (arrows represent method calls): C# program -> C# GPU lib -> C++ CUDA implementation lib A method in the GPU library could look something like this: public static void Map<T>(this ICollec...

How does delete[] "know" the size of the operand array?

Foo* set = new Foo[100]; // ... delete [] set;You don't pass the array's boundaries to delete[]. But where is that information stored? Is it standardised? ...

Is there any way to determine the size of a C++ array programmatically? And if not, why?

This question was inspired by a similar question: How does delete[] “know” the size of the operand array? My question is a little different: Is there any way to determine the size of a C++ array programmatically? And if not, why? Every function I've seen that takes an array also requires an integer parameter to give it the size. But...

Reduce flicker with GDI+ and C++

I'm using GDI+ in a C++/MFC application and I just can't seem to avoid flickering whenever the window is resized. I have already tried these steps: returned TRUE on OnEraseBkGnd(); returned NULL on OnCtlColor(); used double buffering according to this code: void vwView::OnDraw(CDC* pDC) { CRect rcClient; GetClientRect(rcCli...

What is a basic example of "low-level" multi-threading in C++ ?

I'm a kinda newbie developer with a few years under my belt. Recently I interviewed at a game company and was asked "have you done any multi-threading?" I told them about having a C# app with a few Threads... and then I said a bit about transactions and locking etc in Sql. The interviewer politely told me that this was too high-level ...

Multiple Interchangeable Views (MFC/C++)

Hi all, I have a main frame with a splitter. On the left I have my (imaginatively named) CAppView_Leftand on the right I have CAppView_Right_1and CAppView_Right_2. Through the following code I initialise the two primary views correctly: if (!m_wndSplitter.CreateStatic(this, 1, 2)) { TRACE0("Failed to CreateStaticSplitter\n"); r...

Need Advice on Implementing a Time-limited Trial

I'm developing a shareware desktop application. I'm to the point where I need to implement the trial-use/activation code. How do you approach something like this? I have my own ideas, but I want to see what the stackoverflow community thinks. I'm developing with C++/Qt. The intended platform is Windows/Mac/Linux. Thanks for your advice...

Why "delete [][]... multiDimensionalArray;" operator in C++ does not exist

I was always wondering if there is operator for deleting multi dimensional arrays in the standard C++ language. If we have created a pointer to a single dimensional array int *array = new int[size]; the delete looks like: delete [] array; That's great. But if we have two dimension array, we can not do delete [][] twoDimenstionalA...

Code for checking write-permissions for directories in Win2K/XP

Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program using C++. My first guess is to use the C-standard _access function, e.g.: if (_access("C:\mydir", 2) == -1) // Directory is not writable. But apparently on Windows 2000 and XP, _access can't determine directory permissions. (i.e. the...

How can I get the path of a Windows "special folder" for a specific user?

Inside a service, what is the best way to determine a special folder path (e.g., "My Documents") for a specific user? SHGetFolderPath allows you to pass in a token, so I am assuming there is some way to impersonate the user who's folder you are interested in. Is there a way to do this based just on a username? If not, what is the minim...

How do you reverse a string in place in C or C++?

How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string? ...

istream operator

int main() { HandPhone A,B; A>>B;//overloading operator>> to simulate sending sms to another handphone(object) return 0; } How should I declare the istream operator to simulate sending sms to another handphone(object)? ...