Created
September 7, 2016 02:04
-
-
Save fifilyu/a0c2385c1efce874b1fb1469be0e219b to your computer and use it in GitHub Desktop.
jccg90.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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