4

Why do most people comment out pbds code in their template

 2 years ago
source link: http://codeforces.com/blog/entry/98188
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

I am just curious if there will be a problem if I don't if I keep PBDS code uncommented in my template. Can it cause slow execution time or something like that? Also, in case if anyone knows, why isn't ordered set already included in C++ STL library, it there some problems it can cause in real world applications?

9 hours ago, # |

I comment pbds because of compilation time. If you include more headers in your code then the compilation time will be increased so you can save a bit of time when working with algorithms because most of the time it's just not needed.

9 hours ago, # |

Personally, I've never fixed the PBDS issues on MinGW. Due to laziness, I probably never will, so sometimes I just comment it out so it will compile when I don't need to use it, and I uncomment it whenever I need to submit it.

4 hours ago, # |

I don't use it at all because I've seen it being the reason for solutions not passing due to it being somewhat slow.

2 hours ago, # |

I think it's just because some people don't like to include something they don't use in their code.

47 minutes ago, # |

No including PBDS in your code does not slows execution time but it will increase compilation time. Ordered Set is not included in C++ STL because it is not a part of C++ STL , it's a part of GNU based Policy based data structures and is present in GCC only.

The reasons I can think of why most people comment PBDS code in their template are

  • It increases compilation time.
  • On some versions of MinGW the name of file is very weird something like hash_standard_resize_policy_imp.hpp0000644 and on including #include<ext/pb_ds/assoc_container.hpp> in their code throws the error Error was "cannot open source file hash_standard_resize_policy_imp.hpp ". so they don't bother with it and simply comment it out.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK