Hi, I have a class named Particle which has a std::set as a member. The class looks like this:
class Particle {
private:
std::set<vtkIdType> cells;
std::set<vtkIdType>::iterator ipc;
public:
Particle() {};
enum state {EXISTS = -1, SUCCESS = 0, ERROR = 1};
state addCell(const vtkIdType cell);
int numCells() {...
Hi,
If a candidate says that his knowledge in C++ is 7/10 and you want to test his knowledge of references in C++, what question will you ask?
I thought of the following:
Write a function declaration that takes a pointer as reference with default values and ask him to figure out a mistake and explain it.
Pass a literal as argument to...
Will a piece of code that potentially throws an exception have a degraded performance compared a similar code that doesn't, when the exception isn't thrown?
...
Hi ,
Could someone please help and tell me how to use protocol buffers. Actually I want to exchange data through sockets between a program running on unix and anoother running on windows in order to run simulation studies.
The programs that use sockets to exchange data, are written in C/C++ and I would be glad if somneone could help ...
Is there the equivalent of the Windows Media Player SDK for the Zune Player software? I would like to be able to control the volume, play/pause state, and skip to next / previous track.
...
I see the /Gy option and am wondering why I would use it? http://msdn.microsoft.com/en-us/library/xsa71f43.aspx
...
If I want to use the hash function object provided in STL, which header file I should include on Linux? e.g. hash Hf;
...
Item 62 of Sutter and Alexandrescu's book "C++ Coding Standards" is "Don’t allow exceptions to propagate across module boundaries." Should we follow the same rule in C++/CLI?
...
Is there any difference between the below two snippets?
One is a char array, whereas the other is a character array pointer, but they do behave the same, don't they?
Example 1:
char * transport_layer_header;
// Memory allocation for char * - allocate memory for a 2 character string
char * transport_layer_header = (char *)malloc(2 * si...
I wanted to make a linked list class ListList that inherits from a class List.
ListList uses functions from List, but has its own functions. It has its own start pointer that points to the beginning of the list, and its own Node struct that holds a different amount of elements.
But, it looks like, when one of List's functions are called...
I'm pretty new to lockless data structures, so for an exercise I wrote (What I hope functions as) a bounded lockless deque (No resizing yet, just want to get the base cases working). I'd just like to have some confirmation from people who know what they're doing as to whether I've got the right idea and/or how I might improve this.
clas...
I have a dialog application in which I want to have clickable menu items at the top of the dialog. These items do not show a drop down menu but actually run the associated commands.
I did this by setting Popup=False in the dialogs properties and assigning a message-id but my problem is not having the ability to disable the item properl...
Labelled as homework because this was a question on a midterm I wrote that I don't understand the answer to. I was asked to explain the purpose of each const in the following statement:
const char const * const GetName() const { return m_name; };
So, what is the explanation for each of these consts?
...
Here's the current situation I'm in:
I want to distribute a binary app on Linux that would run on several distros (not all of them, just the main ones matter at the moment, let's focus on Ubuntu and Fedora for the sake of this discussion). The app in question links to libbz2 for some of its work. A simple "Hello World" will illustrate t...
I've written a C++ DLL that connects to a Sybase database using the native C library for Sybase. I can build and run the program on my C drive, and others can run it from their C drives, and everything works. But in some situations both my DLL and the Sybase DLL are located on the F drive instead of the C drive. In those cases my DLL app...
Lately I've been working on a few little .NET applications that share some common code. The code has some interfaces introduced to abstract away I/O calls for unit testing.
I wanted the applications to be standalone EXEs with no external dependencies. This seems like the perfect use case for static libraries. Come to think of it thi...
I am not sure why I am getting an "error C2660: 'SubClass::Data' : function does not take 2 arguments". when i try to compile my project.
I have a base class with a function called data. The function takes one argument, There is an overload of Data that takes 2 arguments.
In my subClass I override the data function taking 1 argument. No...
I'm start(really starting) an Assembly tool, at the time it only converts a decimal to a hexadecimal, but I want to remove the zeros from the result. Here is the code:
// HexConvert.cpp
#include <iostream>
using namespace std;
int main()
{
int decNumber;
while (true)
{
cout << "Enter the decimal number: ";
cin...
Motivation: Creating our own file dialog that looks & acts much like the std common dialog
Problem: How to obtain the view pull-down for the current folder/shell container
Apparent Dead Ends:
Query the IShellFolder for its IContextMenu < NULL interface pointer.
Query the IShellView for its IContextMenu < NULL interface pointer.
IShel...
This function is called to serve each client in a new thread. in the consume function, these archives are read and written to but the function returns before the client finishes reading all the response so the socket goes out of scope and closed, creating an exception in client. I'm assuming that any write on the CArchive should block un...