Блог пользователя robell

Автор robell, история, 3 года назад, По-английски
Recently, I came across this snippet of code:
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

which implements a policy based data structure. Yet when I ran it on VS code on my Mac(pls don't judge), the code kept on giving me errors stating that "assoc_container.hpp not found" ect.. I searched online for the source code for the ext folder that assoc_container is located in yet the only thing that I could find is this link which doesn't contain a pb_ds folder. For the people who use policy based data structures, do you guys know whether there is anything I can do so that I'm able to implement these policy based data structures?

PS:I've looked at this blog post Post,but I wasn't gain a verifiable answer on what to do since I'm small brained. I also compile my code with "gcc --std=c++17 $x -o $lol" where $x is the file name of the cpp file and $lol is the output file name.

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
3 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

brew install gcc

And alias the newly downloaded g++ (if you do it now, it's g++-11) in use/local/bin to g++ and run g++ A.cpp and you should be fine.

If things go crazy and it still doesn't work, go to usr/local/bin and delete g++/c++ directories and re run the command.