mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
3f4bb1ae12
By deleting this constructor overload, it fails to compile if you pass a temporary font to this parameter slot. That includes code like sf::Text text("", sf::Font()); but more importantly it prohibits code like this sf::Font getFont() { sf::Font font; // load a font... return font; } sf::Text text("", getFont()); The same idea can be applied to setFont() to prevent setting fonts from a temporary. Credit to Jonny for the idea Co-authored-by: JonnyPtn <jonathan.r.paton@googlemail.com>
10 lines
378 B
C++
10 lines
378 B
C++
#include <SFML/Graphics/Text.hpp>
|
|
|
|
#include <type_traits>
|
|
|
|
static_assert(!std::is_constructible_v<sf::Text, sf::String, sf::Font&&, unsigned int>);
|
|
static_assert(std::is_copy_constructible_v<sf::Text>);
|
|
static_assert(std::is_copy_assignable_v<sf::Text>);
|
|
static_assert(std::is_nothrow_move_constructible_v<sf::Text>);
|
|
static_assert(std::is_nothrow_move_assignable_v<sf::Text>);
|