【问题标题】:GTKmm on Windows (porting) - sigc::mem_fun returning errors from VC++ Express 2010 about deducing template argumentsGTKmm on Windows (porting) - sigc::mem_fun 从 VC++ Express 2010 返回关于推导模板参数的错误
【发布时间】:2011-12-19 01:40:10
【问题描述】:

我正在尝试将我在 Linux 中开发的 GTKmm 应用程序移植到 Windows 中。我有一个包含多个选择的树视图,我需要将这些选择放入 std::vector 中。我使用的代码(在 Linux 中运行良好)是这样的:

        std::vector<Gtk::TreeModel::iterator> rows;
    mp_FileDetailsTree->treeSelection()->selected_foreach_iter(
        sigc::mem_fun(rows, &std::vector<Gtk::TreeModel::iterator>::push_back)
        );

但是,在 Windows 上,(Visual C++ Express 2010)我收到很多这样的错误(重复了很多次):

error C2784: 'sigc::bound_const_volatile_mem_functor7<T_return,T_obj,T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> sigc::mem_fun(T_obj &,T_return (__thiscall T_obj2::* )(T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7) volatile const)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
      c:\devel\gtkmm\include\sigc++-2.0\sigc++\functors\mem_fun.h(6196) : see declaration of 'sigc::mem_fun'

就在 sigc::mem_fun 行。

知道如何解决这个问题吗?谷歌搜索没有任何用处:(。我使用的是 GTKmm 2.22(完整的 Windows 安装程序)。

【问题讨论】:

  • 没关系,我已将代码更改为不再使用 sigc::mem_fun 而是使用 Gtk::TreeSelection::get_selected_rows() 代替。

标签: windows visual-c++ gtk gtkmm libsigc++


【解决方案1】:

直接使用 std::vector::push_back 作为信号处理程序是相当雄心勃勃的。我对编译器感到困惑并不感到惊讶。

我只会使用常规的信号处理方法并在该方法中调用 vector::push_back()。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-07
    • 2018-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-23
    • 1970-01-01
    相关资源
    最近更新 更多