fork(1) download
  1. #include <string>
  2. #include <iostream>
  3. #include <boost/variant.hpp>
  4.  
  5. namespace NsSemSDK
  6. {
  7.  
  8. struct STreeConstructionRuleRegexp {
  9. std::string m_strEntity;
  10. };
  11.  
  12. struct STreeConstructionRuleString {
  13. std::string m_strEntity;
  14. };
  15.  
  16. struct STreeConstructionRuleIdentifier {
  17. std::string m_strEntity;
  18. };
  19.  
  20. typedef int STreeConstructionRuleNumber;
  21.  
  22. std::ostream& operator<<(std::ostream& stream,
  23. const STreeConstructionRuleRegexp& val)
  24. {
  25. return stream << '\'' << val.m_strEntity << '\'';
  26. }
  27.  
  28. std::ostream& operator<<(std::ostream& stream,
  29. const STreeConstructionRuleString& val)
  30. {
  31. return stream << '"' << val.m_strEntity << '"';
  32. }
  33.  
  34. std::ostream& operator<<(std::ostream& stream,
  35. const STreeConstructionRuleIdentifier& val)
  36. {
  37. return stream << val.m_strEntity;
  38. }
  39.  
  40. typedef boost::variant<
  41. STreeConstructionRuleRegexp,
  42. STreeConstructionRuleNumber
  43. > STreeConstructionRuleOperand;
  44.  
  45. // STreeConstructionRuleString, STreeConstructionRuleIdentifier
  46. }
  47.  
  48. using namespace NsSemSDK;
  49.  
  50. int main()
  51. {
  52. STreeConstructionRuleNumber num = 1024;
  53. STreeConstructionRuleOperand operand = num;
  54. std::cout << operand << std::endl;
  55. }
  56.  
  57.  
Success #stdin #stdout 0.01s 2696KB
stdin
Standard input is empty
stdout
1024