mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 07:41:05 +08:00
Require that sf::WindowBase::handleEvents
receives at least one argument
This commit is contained in:
parent
c8c8673259
commit
0831f055ce
@ -57,6 +57,8 @@ struct DelayOverloadResolution
|
|||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
void WindowBase::handleEvents(Ts&&... handlers) // NOLINT(cppcoreguidelines-missing-std-forward)
|
void WindowBase::handleEvents(Ts&&... handlers) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
{
|
{
|
||||||
|
static_assert(sizeof...(Ts) > 0, "Must provide at least one handler");
|
||||||
|
|
||||||
// Disable misc-const-correctness for this line since clang-tidy
|
// Disable misc-const-correctness for this line since clang-tidy
|
||||||
// complains about it even though the code would become uncompilable
|
// complains about it even though the code would become uncompilable
|
||||||
|
|
||||||
|
@ -203,9 +203,6 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
|
|||||||
{
|
{
|
||||||
sf::WindowBase windowBase(sf::VideoMode({360, 240}), "WindowBase Tests");
|
sf::WindowBase windowBase(sf::VideoMode({360, 240}), "WindowBase Tests");
|
||||||
|
|
||||||
// Should compile if user provides nothing
|
|
||||||
windowBase.handleEvents();
|
|
||||||
|
|
||||||
// Should compile if user provides only a specific handler
|
// Should compile if user provides only a specific handler
|
||||||
windowBase.handleEvents([](const sf::Event::Closed&) {});
|
windowBase.handleEvents([](const sf::Event::Closed&) {});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user