Skip to content

Instantly share code, notes, and snippets.

@fifilyu
Created September 7, 2016 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fifilyu/a0c2385c1efce874b1fb1469be0e219b to your computer and use it in GitHub Desktop.
Save fifilyu/a0c2385c1efce874b1fb1469be0e219b to your computer and use it in GitHub Desktop.
jccg90.cpp
#include <cstdio>
#include <vector>
#include <memory>
#include <iostream>
using namespace std;
struct Info {
bool a;
double b;
};
typedef shared_ptr<Info> InfoPtr_t;
void getInfoList(vector<InfoPtr_t> & infoList) {
auto info = make_shared<Info>();
info->a = true;
//info->b = 1.1;
infoList.push_back(info);
}
int main() {
vector<InfoPtr_t> infoList;
getInfoList(infoList);
for (auto it : infoList)
cout << "a=" << it->a << " b=" << it->b << endl;
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment