-1

For example:

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define umap unordered_map
#define uset unordered_set
#define pque priority_queue

I want to add this boilerplate at the start of each C++ source file I create instead of copying it each time.

ReliN404
  • 1
  • 1
  • 3
    Are you really sure you want to do this? It's a really fast way to shoot yourself in the head at least 7 different ways. – user4581301 May 12 '22 at 20:54
  • You should alt least replace those macros with `using` statements [like Rose did here](https://stackoverflow.com/q/72220384/4581301) to reduce the number of ways you can your code up. – user4581301 May 12 '22 at 20:56
  • 1
    Side note: Before `#include ` can speed up your coding, you need to make sure you have precompiled headers up and running. Otherwise including the entire C++ Standard Library will increase the build time of your programs by about an order of magnitude, quickly eating up the time saved by not typing in the correct headers. This is in addition to all of the other problems that come with including the entire C++ Standard Library. – user4581301 May 12 '22 at 20:59
  • `` exists only on some compilers and takes up compile time and memory used by compiler. Precompiled headers solve the problem only partially – Swift - Friday Pie May 12 '22 at 21:01
  • [Here's the canonical on why you should avoid mucking with bits/stdc++.h](https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h), but for what looks a lot like someone setting up for competition coding, the only thing that will matter is the speed concern. – user4581301 May 12 '22 at 21:05
  • 1
    This appears to be like what you're looking for: [File templates](https://www.jetbrains.com/help/clion/using-file-and-code-templates.html) Google found it with the search term *clion defauld file template*. Google so smart. Even worked around the typo. – user4581301 May 12 '22 at 21:15
  • If you need to use macros for abbreviations, consider taking a keyboarding class. Many readers of your code will look at `ll` and have to search your code base to find the definition, then go back to where they were reviewing. The abbreviations also make your code build slower. The preprocessor will have to substitute `long long` everywhere there is an `ll`, *before the code goes to the compiler*. Without those macros, the preprocessor has nothing to do and your build is faster. – Thomas Matthews May 12 '22 at 21:45

0 Answers0