I have read in few different places that using c++0x's new string literals it might be possible to compute a string's hash at compile time. However, no one seems to be ready to come out and say that it will be possible or how it would be done.
Is this possible?
What would the operator look like?
I'm particularly interested use cas...
I've built a program that uses mkl and ipp that runs on mac and linux. I'm now building that program for Windows using cygwin and gcc, and can't get it to link.
The errors I'm getting are:
Warning: .drectve
-defaultlib:"uuid.lib" ' unrecognized
../../../bin/libMath.a(VectorUtility.cxx.o):VectorUtility.cxx:(.text+0x95):
undefi...
Create a class MAT of size m x n. Define the following matrix operations for MAT type objects
a. Addition
b. Subtraction
c. Multiplication.
...
There seem to be a few virtual folders which have GUIDs associated to them (control panel, desktop) -
::{00021400-0000-0000-c000-000000000046} // desktop
Where the blazes are these defined? When are they used?
What I want is a way to have a string which represents a virtual folder without any ambiguity.
If, for instance, I were to...
I'm currently in the process of trying to organize my code in better way.
To do that I used namespaces, grouping classes by components, each having a defined role and a few interfaces (actually Abstract classes).
I found it to be pretty good, especially when I had to rewrite an entire component and I did with almost no impact on the ot...
Using ATL (VS2008) how can I enumerate the available methods available on a given IDispatch interface (IDispatch*)? I need to search for a method with a specific name and, once I have the DISPID, invoke the method (I know the parameters the method takes.) Ideally I would like to do this using smart COM pointers (CComPtr<>).
Is this po...
Hello,
I have a pointer to a structure and I need to implement a method that will copy all of the memory contents of a structure. Generally speaking I need to perform a deep copy of a structure.
Here's the structure:
typedef struct {
Size2f spriteSize;
Vertex2f *vertices;
GLubyte *vertex_indices;
} tSprite;
And here's...
Look at the following code. What is wrong with it? The compiler gives the this error:
In copy constructor person::person(person&)':
No matching function for call toperson::copy(char*&, char*&)'
candidates are: void person::copy(char*&, const char*&) "
Here is the code:
class person
{
public:
person();
person(person ...
I have a base class called Packet:
// Header File
class Packet {
public:
virtual bool isAwesome() const {
return false;
}
}
and an inherited class called AwesomePacket:
// Header File
class AwesomePacket : public Packet {
public:
virtual bool isAwesome() const {
return true;
}
}
However, when I insta...
Is there a way to set the character set to multi byte in code. By that I mean without going into the properties of the compiler and setting it. I mean it by, well...in code. :p
Thanks in advanced it would mean a lot for an answer, this has been bugging me for a while. :D
...
Hi,
I am rather inexperienced C++ programmer, so this question is probably rather basic. I am trying to get the file name for my copula:
string MonteCarloBasketDistribution::fileName(char c)
{
char result[100];
sprintf(result, "%c_%s(%s, %s).csv", copula.toString().c_str(), left.toString().c_str(), right.toString().c_str());
...
I just started learning how to use OpenMP. I am trying to figure out why the following code does not run in parallel with Visual Studio 2008. It compiles and runs fine. However it uses only one core on my quad core machine. This is part of the code that I am trying to port to a MATLAB mex function. Any pointer is appreciated.
#pragma om...
I'm working on a project that's link against SOCI, which comes as both static and dynamic libraries. I'd like CMake to choose the static version when available, and dynamic otherwise. Is there a reasonable way to do this in CMake? I've come up with nothing looking through the docs so far.
...
I'm using the Boost::Test library, and I am trying to check if an actual percent value is close to the expected value:
BOOST_CHECK_CLOSE_FRACTION(
items[i].ExpectedPercent,
items[i].ActualCount / totalCount,
0.05);
For some reason this check fails even when the values are close enough:
difference between items[i].Expected...
im using keybd_event(); and i want use SendMessage(); to send keystroke to notepad, can this be done?
...
I have an application that I want add some cool animations to show state changes. However, wxwidgets would be difficult because I'd have to program these animations in straight gdi. What's the best way to add these effect windows? Should I open a flash window and run a flash sequence or is maybe some other technology? Does .net have some...
I'm trying to compile the simplest program on MacOS 10.6 like:
$ g++ -o hello hello.cpp
the following source:
#include <iostream>
int main (int argc, char * const argv[]) {
std::cout << "Hello, World!\n";
return 0;
}
I'm getting the error:
hello.cpp:1:20: error: iostream: No such file or directory
hello.cpp: In function ‘...
I am writing a program in C++ that launches commands from the DOS operating system using the system() command. So far so good I think. But how can I turn off the screen updating in the console window that pops up so I can't see the thousands of messages that are resulting.
Or, alternatively, how can I dump those messages in some oth...
Here's the basic problem. There's an API which I depend on, with a method using the following syntax:
void foo_api (std::vector<type>& ref_to_my_populated_vector);
The area of code in question is rather performance intensive, and I want to avoid using the heap to allocate memory. As a result, I created a custom allocator which alloc...
I have the following bit of code:
#include <iostream>
#include <list>
#include <algorithm>
#include <iterator>
template<typename Iterator>
void foo(Iterator begin, Iterator end)
{
typedef typename std::iterator_traits<Iterator>::value_type type;
type smallest = (*std::min_element(begin,end));
std::cout << smallest << std::endl...