Skip to content

Instantly share code, notes, and snippets.

@jrziviani
Created June 23, 2017 02:07
Show Gist options
  • Save jrziviani/82946e66599735ec6dcab5f0e8be3ec5 to your computer and use it in GitHub Desktop.
Save jrziviani/82946e66599735ec6dcab5f0e8be3ec5 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <memory>
#include <cstdint>
using namespace std;
struct x
{
int32_t xa;
unique_ptr<double[]> xb;
x(int32_t i) :
xa(i),
xb(unique_ptr<double[]>(new double[i])) {}
};
int main() {
x lines[10](5);
for (size_t i = 0; i < 10; ++i) {
for (size_t j = 0; j < 5; ++j) {
lines[i].xb[j] = 10.5;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment