Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#include <cctype>
#include <iostream>

#include "HLTrigger/Timer/interface/processor_model.h"

const char* article(char letter) {
  switch (tolower(letter)) {
    case 'a':
    case 'e':
    case 'i':
    case 'o':
    case 'u':
    case 'y':
      return "an";
    default:
      return "a";
  }
}

const char* article(const char* word) { return word == nullptr ? nullptr : article(word[0]); }

const char* article(const std::string& word) { return word.empty() ? nullptr : article(word[0]); }

int main() {
  std::cout << "Running on " << article(processor_model) << " " << processor_model << std::endl;

  return processor_model.empty();
}