Skip to main content
Remove extra puncutation
Source Link
Stephen Rauch
  • 4.3k
  • 12
  • 24
  • 36

??? I I don't understand your motivation as stated. I've just tried to compile the code below with:

gcc  -std=c++11 -Wall -Wpedantic

And it compiles just fine. Default constructor, copy constructor and all... No warnings, either. Something in your declaration is preventing you to use the default constructors, but it's not because A is not fully defined.

#include <vector>

struct A;

struct B {
  A* a;
};

int main()
{
  B x = B(), y{nullptr};
  B z(x);

  x = y;

  std::vector<B> v;

  return v.size();
}

??? I don't understand your motivation as stated. I've just tried to compile the code below with:

gcc  -std=c++11 -Wall -Wpedantic

And it compiles just fine. Default constructor, copy constructor and all... No warnings, either. Something in your declaration is preventing you to use the default constructors, but it's not because A is not fully defined.

#include <vector>

struct A;

struct B {
  A* a;
};

int main()
{
  B x = B(), y{nullptr};
  B z(x);

  x = y;

  std::vector<B> v;

  return v.size();
}

I don't understand your motivation as stated. I've just tried to compile the code below with:

gcc  -std=c++11 -Wall -Wpedantic

And it compiles just fine. Default constructor, copy constructor and all... No warnings, either. Something in your declaration is preventing you to use the default constructors, but it's not because A is not fully defined.

#include <vector>

struct A;

struct B {
  A* a;
};

int main()
{
  B x = B(), y{nullptr};
  B z(x);

  x = y;

  std::vector<B> v;

  return v.size();
}
Source Link

??? I don't understand your motivation as stated. I've just tried to compile the code below with:

gcc  -std=c++11 -Wall -Wpedantic

And it compiles just fine. Default constructor, copy constructor and all... No warnings, either. Something in your declaration is preventing you to use the default constructors, but it's not because A is not fully defined.

#include <vector>

struct A;

struct B {
  A* a;
};

int main()
{
  B x = B(), y{nullptr};
  B z(x);

  x = y;

  std::vector<B> v;

  return v.size();
}