Language:
C++     Change language:
Pastebin: 125974
Author: Cogwheel
Subject: ^_^
Created: 2009-10-01 16:29:44
Download and save
Toggle line numbers
1#include <stdexcept> 
2 
3class Underscore 
4{ }; 
5 
6template<typename T> 
7class UnderscoreSupport 
8
9public: 
10    UnderscoreSupport(const T& left) : _left(left) {  } 
11    void operator ^(const T& right) const 
12    { 
13        if (_left == right) 
14            throw std::runtime_error("You suck, n00b!"); 
15    } 
16private: 
17    const T& _left; 
18}; 
19 
20template<typename T> 
21UnderscoreSupport<T> operator ^(const T& left, Underscore right) 
22
23    return UnderscoreSupport<T>(left); 
24
25 
26const Underscore _; 
27 
28int main() 
29
30    int f = 5; 
31 
32    f ^_^ 6; // 6 != 5 
33 
34    f ^_^ 5; // DIE DIE DIE! 
35 
36    return 0; 
37
Thread:
[125974] ^_^ by Cogwheel at 2009-10-01 16:29:44
  [125979] Re: ^_^ by Cogwheel at 2009-10-01 19:08:58 (diff)
    [125982] Re: ^_^ by Cogwheel at 2009-10-01 19:18:07 (diff)
Tip: Click the line numbers to toggle highliting on that line.

Paste followup:

Language:
Author:
Subject:


    Tabstop:     bigger biggest
Note: You can prefix a line with "@@@" to highlight it.