[ create a new paste ] login | about

Link: http://codepad.org/rWDDB7tj    [ raw code | output | fork ]

C++, pasted on Dec 7:
1
2
3
4
5
6
7
8
class MyClass {
    std::vector<int> v;

  public:
    std::vector<int>& getVector() const {
       return v;
    }
};


Output:
1
2
3
t.cpp: In member function '__gnu_debug_def::vector<int, std::allocator<int> >& MyClass::getVector() const':
Line 6: error: invalid initialization of reference of type '__gnu_debug_def::vector<int, std::allocator<int> >&' from expression of type 'const __gnu_debug_def::vector<int, std::allocator<int> >'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: