KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I just found that C++ doesn't give any warnings for casting from pair<double, int> to pair<int, int> , which is a little surprising. Here is my program test_pair.cpp : #include <vector> #include <utility> using namespace std; int main() { std::vector<pair<int, int> > v; pair<double, int> p = make_pair(3.8, 3); v.push_back(p); } I compile it using g++ test_type.cpp -Wall -Wconversion , but still no warnings are generated. I am using g++ v4.6.1. Anyone got any idea how to make g++ generate a warning for this, or it just can't be done?
Tags (comma-separated)
Save Edits
Cancel