SFML community forums
General => Feature requests => Topic started by: Hydrogen on February 25, 2017, 03:00:59 am
-
Many of the simple containers (such as vectors and rectangles) out to have constexpr constructors and arithmetic operators. This is both a matter of efficiency and convenience.
Example 1:
auto vector_sum = sf::Vector2f{1, 2} + sf::Vector2f{3, 4}; // Optimization: compute vector_sum at compile-time if operator + is constexpr.
Example 2:
struct Foo {
static constexpr sf::Vector2f vector_constant{5, 6}; // Only possible if ctor is constexpr.
...
}
-
http://en.sfml-dev.org/forums/index.php?topic=21571.0
-
That's odd; I specifically searched for "constexpr" using the search tool before I posted. Nothing showed up.
-
It's not specifically about constexpr, but rather about supporting new C++ standards, so yes you may not find it by searching a specific language keyword.