Created
March 16, 2018 04:19
-
-
Save JacopoMangiavacchi/a633f43d4eee3319720e45cddbfab7c7 to your computer and use it in GitHub Desktop.
C++ std::list test
This file contains hidden or 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 <list> | |
int main(int argc, const char * argv[]) { | |
std::list<void*> list; | |
list.push_back((void*)"1"); | |
list.push_back((void*)"2"); | |
list.push_back((void*)"3"); | |
list.push_front((void*)"0"); | |
assert(list.size() == 4); | |
assert(!strcmp((char*)list.front(), "0")); | |
std::list<void*>::const_iterator it = list.begin(); | |
it++; | |
it++; | |
assert(!strcmp((char*)*it, "2")); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment