fork(28) download
  1. #include <string>
  2. #include <cstdint>
  3. #include <iostream>
  4. #include <type_traits>
  5. #include <unordered_map>
  6.  
  7. enum class Experience : uint8_t {
  8. None = 0,
  9. Linux = 1 << 0,
  10. Multithreading = 1 << 1,
  11. Socket = 1 << 2,
  12. Highload = 1 << 3,
  13. CPlusPlus11 = 1 << 4,
  14. DataStructs = 1 << 5,
  15. Patterns = 1 << 6,
  16. Algorithms = 1 << 7,
  17. All = UINT8_MAX
  18. };
  19.  
  20. inline constexpr Experience operator|(Experience x, Experience y) {
  21. return static_cast<Experience>(static_cast<uint8_t>(x) | static_cast<uint8_t>(y));
  22. }
  23.  
  24. inline constexpr Experience operator&(Experience x, Experience y) {
  25. return static_cast<Experience>(static_cast<uint8_t>(x) & static_cast<uint8_t>(y));
  26. }
  27.  
  28. inline constexpr bool operator==(Experience x, Experience y) {
  29. return static_cast<uint8_t>(x) == static_cast<uint8_t>(y);
  30. }
  31.  
  32. template<Experience Mask>
  33. struct Applicant {
  34. static const bool value = ((Mask & Experience::All) == Experience::All);
  35. };
  36.  
  37. template<typename T>
  38. class Suitability {
  39. template<typename U>
  40. static int8_t f(typename std::enable_if<U::value, bool>::type*);
  41.  
  42. template<typename U>
  43. static int32_t f(...);
  44.  
  45. public:
  46. static const bool value = (sizeof(f<T>(0)) == sizeof(int8_t));
  47. };
  48.  
  49. int main(int argc, const char * argv[]) {
  50. std::unordered_map<uint8_t, std::string> result = { { 0, "Unsuitable" }, { 1, "Suitable" } };
  51. static constexpr Experience experience = Experience::None; // specify your skills here
  52. std::cout << result[Suitability<Applicant<experience>>::value] << std::endl;
  53. return 0;
  54. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
Unsuitable