Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
2 votes
3 answers
336 views

I'm experimenting with a function template that performs assignment: #include <vector> #include <memory> template<typename T> void foo(T& a, const T& b) { a = b; } int ...
1 vote
2 answers
99 views

I have a function capable of translating UTF-8 characters into a custom 8-bit encoding: const fn char_to_custom_encoding(c: char) -> u8; I'd like to apply it at compile time to a string literal so ...
0 votes
1 answer
141 views

I'm not a Nim user, but I was astonished by how the solution for this exercise on Exercism. The text of the exercise is as follows: Your task is to convert a number into its corresponding raindrop ...
-1 votes
2 answers
107 views

I have struct/class that formats numbers. I want to tune its formatting parameters how i like. And this means I "need"(could be not, if there's another much more clever way of doing it?): &...
3 votes
1 answer
101 views

In The C++ Programming Language - 4th edition, in §25.3 at page 731-732 Bjarne Stroustrup shows a possible implementation of a Vector template class that's been specialized for all T* template ...
3 votes
1 answer
345 views

I'm learning Zig and I'm trying to write a generic function that automatically serializes any struct into JSON. In languages like Rust or Go, there are libraries that can iterate over the fields of a ...
2 votes
3 answers
236 views

How to iterate over tuple in compile-time? problem code: #include <array> #include <cstddef> #include <tuple> namespace { class Solution { public: template <size_t ...
0 votes
1 answer
93 views

I’m exploring ways in C++20 to represent a JSON text literal entirely in the type system, so that I can then write a metafunction like template<typename Json, char... Key> struct HasKey; ...
0 votes
2 answers
94 views

I've compiled other stored procedures (from SQuirrel© v4.8) and was able to figure out the error messages sufficiently to find my errors until I get a successful compile. But this time I'm getting ...
0 votes
0 answers
65 views

This is a bit of a follow up to a previous question. Here's two functions that take 2 or 3 inputs respectively, and produce each a list of fixed-size vectors, of sizes 2 and 3 respectively: import ...
0 votes
2 answers
194 views

I am writing a log function that takes a format string and a variable number of arguments and captures std::source_location. This is not straightforward, so I tried the FormatWithLocation solution ...
bers's user avatar
  • 6,331
0 votes
1 answer
135 views

Out of curiosity, and with hope of learning useful compile-time techniques, I'm trying to understand how std::format performs compile-time checking of its arguments. I started from the implementation ...
4 votes
4 answers
283 views

I have a template function with several type parameters and depending on those types, the function "calls" an static_assert(false). I want to know when my code fails to compile for specific ...
2 votes
1 answer
120 views

Is there a way to filter macro or array data at compile time in C? For example: #define THRESHOLD 5 #define MACRO_DATA \ X( 1 ) \ X( 8 ) \ X( 3 ) \ X( 12 ) \ X( 5 ) // ...
4 votes
1 answer
146 views

Is there a way to automatically (and at compile time) define a "product enum class" (i.e. an enum class that takes on values in the product space between two given enum classes)? So if I ...

15 30 50 per page
1
2 3 4 5
...
67

AltStyle によって変換されたページ (->オリジナル) /