What's the correct way to do this with g++:
template < typename F >
void g (F f);
template < typename ... A >
void h (A ... a);
template < typename ... A >
void f (A ... a) {
g ([&a] () { h (a...); }); // g++-4.6: error: parameter packs not expanded with »...«
}
...
Given a void pointer, if I want to make the void pointer point to x bytes ahead, how will this be best done? Is there a better way than casting to a char pointer?
...
I am trying to implement a custom memory manager, I am wondering if there is a better way to implement this function as when i asked about void pointer arithmetic, several people thought that if i had a void* in C++, something was very wrong.
// allocates a page of memory.
void ObjectAllocator::allocatePage()
{
//if(OAStats_.Pag...
Having class :
template<class T>
class Link
{
Link* myParent_;
Link* myLeft_;
Link* myRight_;
T* myData_;
void assign_(Link<T>*& marker, Link<T>*& aLink);
void insert_(const T&);//inserts new data into a link
void insert_(const T*);
void remove_();//removes data...
Hi,
while trying to compile the following code in OpenCV2 in linux,
cv::Mat image1, image2;
cv::Rect rect1, rect2;
...
image1(rect1).copyTo(image2(rect2));
I get the following error:
x.cpp: In member function ‘cv::Mat Process(cv::Mat)’:
x.cpp:241: error: no matching function for call to ‘cv::Mat::copyTo(cv::Mat)’
cxcore.hpp:7...
Hi,
This is my sample code. Please let me know why it crashes over here.
string MyFunction::GetString(unsigned char* inStrReference)
{
unsigned char* bufPtr = inStrReference;
string newstring = (char*)bufPtr;
return newstring;
}
...
what is the equivalent function for isalpha or isalnum using wchar_t?
wctype ?
an example would be nice also
thanks
...
Hi,
how can I print the full call stack when a std::exception raises?
...
here is code
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <fstream>
#include <iterator>
using std::vector;
using std::string;
using std::cout;
using std::cin;
using std::ostream_iterator;
using std::cout;
int main(){
vector <string> me;
string s;
while ((cin>>s) && s!="end")
...
Hello, I have a situation that looks like the following code:
#include <iostream>
class A
{
public:
A() { std::cout << "A created!" << std::endl; }
~A() { std::cout << "A destroyed!" << std::endl; }
virtual const char* Name() { return "A"; }
};
class B : public A
{
public:
B() { std::cout << "B created!" << std::endl;...
I have written a class with protected constructor, so that new instances can only be produced with a static create() function which returns shared_ptr's to my class. To provide efficient allocation I'd like to use boost::make_shared inside the create function, however the compiler complains that my class constructor is protected inside b...
Possible Duplicate:
When do we have to use copy constructors?
Why exactly are C++ copy constructors so important? I just learned about them and I don't quite see what is the fuss about them. It seems you should always write a copy constructor for your classes if you use pointers, but why?
Thanks, Boda Cydo.
...
I get this error when i try to start a program that I've made in C++. It works fine on my other computer (XP SP3 32bit) but not on my windows 7 64 bit version.
When I run Dependency Walker on the program, it tells me that IESHIMS.dll is missing, however it's there in the Internet Explorer folder of both 32 and 64 bit version..
Can anyon...
Free function allocate_shared can be used with any standard compliant allocator. But what about shared_ptr's constructor and reset method.
template<class Y, class D, class A> shared_ptr(Y * p, D d, A a);
template<class Y, class D, class A> void reset(Y * p, D d, A a);
The manual says that D should provide a call operator which will be...
Okay this one may be a bit out from left field, but I'm going to try anyways.
A pad is a sort of ambient electronic sound that kind of 'hums'. Something like this .
How can I produce this in code? Using either Processing, OpenFrameworks, C, Objective-C or C++. Keep in mind I haven't been programming for that long.
I will be very imp...
Hi,
I have a basic question for all of the math experts out there.
"If I have an academic paper, whats the easiest way to convert a simple mathematical equation into working Matlab (or C++) code?"
Ideally, there would be a Latex >> Matlab (or C++) conversion tool.
However, failing this, is there a "cheat sheet" which contains all of ...
Please note that I don't want to solve any problem with my question - I was thinking about probabilities of things to happen and thus was wondering about something:
What exactly happens if you delete on object and use gcc as compiler?
Last week I was investigating a crash, where a race condition lead to an double delete of an object.
...
I've recently tackled the constructor problem, where various mixins classes that decorate each other (and a topmost host class) have different constructor signatures. To maintain a single constructor in the resulting decorated class, and without adding init functions, I've found the following solution. The only restriction it places on a...
Suppose you've written a portable C++ code which runs smoothly on different platforms. To make some modifications to optimize performance, you use inline assembly inside your code. Is it a good practice (compiler optimization set aside) or will it make troubles for portability?
...
UPDATE: Let me clarify my files and reiterate my question:
main.h
#include "other.h"
class MyClass
{
public:
void MyMethod();
void AnotherMethod();
OtherClass test;
}
main.cpp
#include "main.h"
void MyClass::MyMethod()
{
OtherClass otherTemp; // <--- instantitate OtherClass object
otherTemp.OtherMethod...