Created
November 21, 2016 04:51
-
-
Save tredpath/5f762151c1595246cd21c4503bded3ea to your computer and use it in GitHub Desktop.
Testing vector type with Intel compiler
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 <vector> | |
#include <string> | |
using namespace std; | |
struct Foo | |
{ | |
Foo() { } | |
Foo(const Foo& type) | |
{ | |
//comment out this loop and it works | |
for (const auto& val : type.list) { } | |
} | |
~Foo() | |
{ | |
//this fails if the vector has been iterated over | |
list.clear(); | |
} | |
vector<string> list; | |
}; | |
int main() | |
{ | |
vector<Foo> vec; | |
//generate some test data | |
for (int i = 0; i < 20; i++) | |
{ | |
Foo bar; | |
bar.list.push_back("Test1"); | |
bar.list.push_back("Test2"); | |
bar.list.push_back("Test3"); | |
vec.push_back(bar); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment