jupyter-xeus / cpp-terminal

C++ library for writing multiplatform terminal applications
https://jupyter-xeus.github.io/cpp-terminal/
Other
490 stars 53 forks source link

Addition of Metakey and Key results in warning of deprecation #286

Closed TobiasWallner closed 11 months ago

TobiasWallner commented 1 year ago

With the PR #282 Event(2) the addition of MetaKeys and normal Keys have been introduced, but when compiling with GCC version 12.2 I get the following warning when doing so:

warning: arithmetic between different enumeration types ('Term::MetaKey::Value' and 'Term::Key::Value') is deprecated [-Wdeprecated-enum-enum-conversion]
                case Term::MetaKey::Ctrl + Term::Key::q : this->quit(); break;
                     ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
TobiasWallner commented 1 year ago

@flagarde I would propose to repace:

class Key{
  enum Value{
  ...

with:

enum class Key{
  ...

and then change all the members to pure non member functions as well as the binary operators+ If you agree then I will do so and prepare a followup pull request.