-1
std::pair<std::vector<Gtk::TargetEntry>, int> MyClass::get_drag_info()
{
    return std::make_pair<std::vector<Gtk::TargetEntry>, int>(
                   m_drag_targets, m_drag_data_format);
}

Why the above function does not work? and how do I make it work?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
codekiddy
  • 5,897
  • 9
  • 50
  • 80
  • 5
    `make_pair` is intended to *deduce* the pair template arguments. If you want to provide those explicitly, just use `pair<..>(..)` or in C++11, brace-initialization `return {..}`. – dyp Jul 28 '14 at 11:54
  • What are the types of `m_drag_targets, m_drag_data_format`? And what is the complete error message? – interjay Jul 28 '14 at 11:56
  • 1
    Please provide more information about the context. If possible, please create a [MCVE](http://stackoverflow.com/help/mcve). – dyp Jul 28 '14 at 11:56
  • @interjay m_drag_target and m_drag_data_format are of type as typed in return type of a function, answer by doctorlove solved the problem – codekiddy Jul 28 '14 at 12:00
  • @dyp thanks for putting this out. – codekiddy Jul 28 '14 at 12:04

1 Answers1

3

You frequently get this message when you haven't included the required header.

For std::make_pair you must #include <utility>

As noted in the comments you don't need to specify the template arguments...

return std::make_pair(m_drag_targets, m_drag_data_format);

should suffice.

doctorlove
  • 18,872
  • 2
  • 46
  • 62