StackOverflow Questions for Tag: constexpr-function

AR-47
AR-47

Reputation: 23

Stroustrup book constexpr example does not compile in VS C++ 2022

Score: 2

Views: 92

Answers: 2

Read More
tower120
tower120

Reputation: 5265

Can't use function parameter of a constexpr function in a constant expression

Score: 23

Views: 36567

Answers: 3

Read More
Bahram Pouryousefi
Bahram Pouryousefi

Reputation: 141

Creating constexpr map filled by calls to a constexpr function in C++ 17

Score: 0

Views: 109

Answers: 1

Read More
Warren  P
Warren P

Reputation: 69072

Should I declare a constant instead of writing a constexpr function?

Score: 399

Views: 159787

Answers: 15

Read More
PaperBirdMaster
PaperBirdMaster

Reputation: 13298

constexpr function that keeps multiplying a number until "it is big enough"

Score: 1

Views: 222

Answers: 3

Read More
Torsten Knodt
Torsten Knodt

Reputation: 766

How can I get a constexpr size from a std::set, which I can use to return a std::array with the number of elements in the std::set in C++23?

Score: 2

Views: 215

Answers: 1

Read More
vohir
vohir

Reputation: 23

How do `constexpr` "compile time pointers" work in C++?

Score: 0

Views: 82

Answers: 1

Read More
nectarine
nectarine

Reputation: 145

How can I initialise a constexpr array with values using std::generate

Score: 2

Views: 1908

Answers: 2

Read More
Oersted
Oersted

Reputation: 2734

Why is it possible to use the return of a lambda, passed as argument of a constexpr function argument, in a constant expression within the function?

Score: 9

Views: 995

Answers: 2

Read More
NormakLOE32
NormakLOE32

Reputation: 39

Using constexpr for both runtime and compile-time evaluations - passing constexpr value as a function parameter

Score: 1

Views: 158

Answers: 2

Read More
ntos
ntos

Reputation: 319

cout is able to run at compile-time

Score: 0

Views: 122

Answers: 1

Read More
icecity96
icecity96

Reputation: 1227

Use of constexpr function before definition fails

Score: 31

Views: 3555

Answers: 2

Read More
John Kalane
John Kalane

Reputation: 1185

Where in the C++20 standard (N4860) does it say that an inline function must be defined before its use in a translation unit?

Score: 0

Views: 157

Answers: 1

Read More
yqZhang4480
yqZhang4480

Reputation: 522

Can any reentrant function in C++ be refactored into a constexpr function?

Score: 0

Views: 100

Answers: 1

Read More
lsbbo
lsbbo

Reputation: 312

Do constexpr functions have to be defined before they are used?

Score: -1

Views: 93

Answers: 2

Read More
Brotcrunsher
Brotcrunsher

Reputation: 2254

Given C++23 relaxations on constexpr, can't constexpr be the default?

Score: 10

Views: 1692

Answers: 1

Read More
Oersted
Oersted

Reputation: 2734

virtual and constexpr before up to C++17

Score: 3

Views: 645

Answers: 1

Read More
Finn Eggers
Finn Eggers

Reputation: 945

Why does gcc 12.2 not optimise divisions into shifts in this constexpr function called from main()

Score: 4

Views: 305

Answers: 1

Read More
Waker
Waker

Reputation: 235

What are the conditions that `constexpr` will start a new constant expression context?

Score: 3

Views: 146

Answers: 1

Read More
Satyam Sharma
Satyam Sharma

Reputation: 29

Different compilation results with template and non-template class having constexpr constructor

Score: 2

Views: 140

Answers: 1

Read More
PreviousPage 1Next