Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
1 answer
128 views

I am trying to express the structure of a sparse matrix (and the structure resulting from sparse matrix operations) at compile time with template parameters and constexpr functions. I've defined this ...
2 votes
1 answer
434 views

c23 added the constexpr keyword to the standard, which seems to me to be quite puzzling. I understand that the appeal would be that constexpr objects evaluate to constant expressions, whereas static ...
6 votes
1 answer
144 views

I have a static_string template template <std::size_t N> struct static_string { std::array<char, N + 1> elements_; constexpr static_string() noexcept : elements_{} {} ...
1 vote
2 answers
143 views

n3301, 6.6 Constant expressions, p4 (emphasis added): Each constant expression shall evaluate to a constant that is in the range of representable values for its type. n3301, 6.5.15 Logical OR ...
0 votes
1 answer
43 views

I keep getting an error on while trying to create an App. // Determine which fragment to display based on the item selected switch (item.getItemId()) { case R.id.nav_insert_meal: ...
6 votes
1 answer
281 views

I have a Go program that performs bit shifting and division operations on the length of a string constant, but the output is not what I expect. Here's the code: package main import "fmt" ...
9 votes
2 answers
1k views

The wording of the question title is probably incorrect and I'll fix it happily from your suggestions. My question can be illustrated by this snippet: #include <array> template <typename ...
2 votes
1 answer
274 views

I'm observing an inconsistency between GCC and Clang with respect to what is a constant evaluated context. I played with different situations: #include <iostream> #include <type_traits> ...
3 votes
0 answers
102 views

I've been trying to make some of my code more airtight by moving some runtime operations to compile time. I thought it would be simpler because I'm only trying to increment or decrement a number by ...
1 vote
1 answer
106 views

I have a set of C files that I'm trying to compile //table.c #include "row.h" const uint32_t ROW_SIZE_1 = 50; //some random number const uint32_t PAGE_SIZE = 4096; const uint32_t ...
2 votes
1 answer
151 views

After reading about constant expressions I wrote the following example that compiles with msvc but is rejected by both gcc and clang. int *const ptr2 = nullptr; static_assert(!ptr2); //msvc passes ...
0 votes
1 answer
186 views

I have an set of registers in MCU, and each of them has an unique adress. Imagine I have some register, that can be described with struct struct RegisterDefinition{ u32 v1; u32 v2; u32 v3; ...
0 votes
0 answers
108 views

I need to update this map to include one more key-pair. The map is const std::map<char, std::shared_ptr<const TrieNode>> children_. The const seems to block any method that is tried. ...
Marko's user avatar
  • 1
2 votes
3 answers
370 views

In C++23, the [[assume(conditonal-expression)]] attribute makes it so that if conditional-expression doesn't evaluate to true, the behavior is undefined. For example: int div(int x, int y) { [[...
1 vote
1 answer
81 views

I get the following error in my project upon compiling. Tried everything but unable to resolve this. Reproduced the error here: https://replit.com/join/egfoiwpgig-darshanpandhi Error error: constexpr ...

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

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