How to concatenate static strings at compile time?

I recently revisited this problem, and found that the previous answer I gave produced ridiculously long compile times when concatenating more than a handful of strings. I have produced a new solution which leverages constexpr functions to remove the recursive templates responsible for the long compilation time. #include <array> #include <iostream> #include <string_view> template <std::string_view … Read more

Is there an Oracle SQL query that aggregates multiple rows into one row? [duplicate]

(WARNING – WM_CONCAT is an unsupported function that was removed in version 12c. Unless you’re using a very old database, you should avoid this function. You should probably use LISTAGG instead.) It depends on the version of Oracle you’re using. If it supports the wm_concat() function, then you can simply do something like this: SELECT … Read more

String.format() vs “+” operator [duplicate]

If you are looking for performance only I believe that using StringBuilder/StringBuffer is the most efficient way to build strings. Even if the Java compiler is smart enough to translate most of String concatenations to StringBuilder equivalent. If you are looking for readability the String.format thing is the much clearer I think, and this is … Read more

Memory usage of concatenating strings using interpolated vs “+” operator

The author doesn’t actually say that one makes better use of memory than the other. It says that the one method “makes good use of memory” in the abstract, which, by itself, doesn’t really mean much of anything. But regardless of what they said, the two methods aren’t going to be meaningfully different in their … Read more

tech