<commit_before>
#include <iostream>

enum class Side
{
  Null = 0,
  Left = 1,
  Right = 2,
};

// http://stackoverflow.com/questions/2393439/can-i-overload-operators-on-enum-types-in-c
//   Yes, operator overloading can be done on enum and class types. 
//
// http://stackoverflow.com/questions/12753543/is-it-possible-to-manually-define-a-conversion-for-an-enum-class
//   No, it's not. Actually, an enum class is no class at all. 
//   The class keyword is only used because suddenly changing the unscoped enum to a scoped enum would have mean reworking all enums codes. 

bool operator !(Side s) {
   return s != Side::Null;
}

// // C++ syntax memo
// class B
// {
// };
// 
// class A {
// public:
//   operator B()  // b = (B) a; // will call this type converstion operator
//   {
//   }
// };

int main()
{
 Side s = Side::Left;
// bool b = !s;

 using namespace std;
 cout << "opeator! (Side) = " << !s << endl;
 
}<commit_msg>add more learning for enum class<commit_after>
#include <iostream>

enum class Side
{
  Null = 0,
  Left = 1,
  Right = 2,
};

// http://stackoverflow.com/questions/2393439/can-i-overload-operators-on-enum-types-in-c
//   Yes, operator overloading can be done on enum and class types. 
//
bool operator !(Side s) {
   return s != Side::Null;
}

// http://stackoverflow.com/questions/12753543/is-it-possible-to-manually-define-a-conversion-for-an-enum-class
//   No, it's not. Actually, an enum class is no class at all. 
//   The class keyword is only used because suddenly changing the unscoped enum to a scoped enum would have mean reworking all enums codes. 
//
// // C++ syntax memo
// class B
// {
// };
// 
// class A {
// public:
//   operator B()  // b = (B) a; // will call this type converstion operator
//   {
//   }
// };

int main()
{
 Side s = Side::Left;
// bool b = !s;

 using namespace std;
 cout << "opeator! (Side) = " << !s << endl;

 if (!!s) // !! idiom of C++, to use any type in 'bool' place: First operator! to bool, then ! on bool 
 {
   cout << "Side pass test" << endl;
 }

 
}
{'fraction_non_alphanumeric': 0.1616062683643487, 'fraction_numerical': 0.01762977473065622, 'mean_word_length': 2.5842105263157893, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4123825', 'n_tokens_mistral': 744, 'n_tokens_neox': 705, 'n_words': 233}