fork download
  1.  
  2. template <typename T> class property {
  3. T value;
  4. public:
  5. T & operator = (const T &i) {
  6. return value = i;
  7. }
  8.  
  9. operator T const & () const {
  10. return value;
  11. }
  12. };
  13.  
  14.  
  15. struct Bar {
  16. // Using the property<>-template.
  17. property <bool> alpha;
  18. property <unsigned int> bravo;
  19. };
  20.  
  21. int main () {
  22. Bar bar;
  23. bar.alpha = true;
  24.  
  25. return bar.bravo;
  26. }
  27.  
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty