Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <boost/type_index.hpp>
- using namespace std;
- using boost::typeindex::type_id_with_cvr;
- int main()
- {
- vector<int> vec{100};
- for (auto ele : vec)
- cout << type_id_with_cvr<decltype(ele)>() << endl; // int
- for (const auto &ele : vec)
- cout << type_id_with_cvr<decltype(ele)>() << endl; // int const&
- for (auto &&ele : vec) {
- cout << type_id_with_cvr<decltype(ele)>() << endl; // int &
- ++ele;
- cout << vec.front() << endl; // 101
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement