Hi There,
Can anyone explainme why this piece of code doesn´t work?
I'm running VC 6.0 / W2K.

Code:
#include 
#include 
#include 
#include 

using std::string;
using std::cout;
using std::vector;
using std::ostream;
using std::endl;

class Dog {
string nm;
public:
Dog ( void ) : nm("NO NAME") {}
Dog(const string& name) : nm(name) {
cout << "Creating Dog: " << *this << endl;
}
// Synthesized copy-constructor & operator= 
// are correct.
// Create a Dog from a Dog pointer:
Dog(const Dog* dp, const string& msg) 
: nm(dp->nm + msg) {
cout << "Copied dog " << *this << " from "
<< *dp << endl;
}
~Dog() { 
cout << "Deleting Dog: " << *this << endl;
}
void rename(const string& newName) {
nm = newName;
cout << "Dog renamed to: " << *this << endl;
}
friend ostream&
operator<<(ostream& os, const Dog& d) {
return os << "[" << d.nm << "]";
}
};

class DogHouse {
Dog* p; //Dog array
string houseName;
public:
DogHouse (Dog * lpDog, const size_t size) : p(new Dog[size]) {
memcpy(p, lpDog, size);
}
DogHouse(Dog* dog, const string& house)
: p(dog), houseName(house) {}
DogHouse(const DogHouse& dh)
: p(new Dog(dh.p, " copy-constructed")),
houseName(dh.houseName 
+ " copy-constructed") {}
DogHouse& operator=(const DogHouse& dh) {
// Check for self-assignment:
if(&dh != this) {
p = new Dog(dh.p, " assigned");
houseName = dh.houseName + " assigned";
}
return *this;
}

void renameHouse(const string& newName) {
houseName = newName;
}
Dog* getDog() const { return p; }
~DogHouse() { delete p; }
friend ostream&
operator<<(ostream& os, const DogHouse& dh) {
return os << "[" << dh.houseName 
<< "] contains " << *dh.p;
}
}; 

int main() {

Dog arrDog[2][10] = {
{ Dog("01"),Dog("02"),Dog("03"),Dog("04"),Dog("05") },
{ Dog("11"),Dog("12"),Dog("13"),Dog("14"),Dog("15") }
};
vector HouseContainer;
/*HouseContainer.push_back(DogHouse(new Dog(arrDog[0]," From static array"), "Static array"));*/
HouseContainer.push_back(DogHouse(arrDog[0], sizeof(Dog)));
/*HouseContainer.push_back(DogHouse(new Dog("Kido"), "KidoHouse"));*/

std::copy(HouseContainer.begin(),
HouseContainer.end(),
std::ostream_iterator(cout,"\n")); 

return 1;
}

Assert Memory error raised when trying to do bookeeping.
I guess the problem is how static array of 'Dogs' is copied (using memcpy) to the new object 'DogHouse'.

Can anyone tell me how can I make this idea work without changing the interface, I mean I would like to keep using Dog pointer to store the array of Dog instead of a vector or other containers.

Thanks in advanced.
Carlos.