Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class T>
- class nonnull{
- public:
- nonnull(T& t)
- :t(&t){
- }
- operator T&(){
- return *t;
- }
- private:
- T* t;
- };
- int main(){
- int i;
- nonnull<int> x(i); // ok
- nonnull<int> n; // woops
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement