小编Qua*_*arl的帖子

什么类型的多线程最好学习?

我想学习C++中的多线程,但我不确定哪种类型最有用.我看过教程的是:

  • Windows本机调用
  • OpenMP的
  • 促进

(我确信可能还有更多.)

每个人的主要特征是什么,它们最适合用于什么?

注意:我已经通过手动创建线程在C#中完成了一些多线程,线程的更复杂性只会让它变得更有趣.:)

c++ multithreading

7
推荐指数
2
解决办法
1183
查看次数

绘制光滑边缘立方体的最佳方法是什么?Bezier曲线,加载.3ds或其他?

我需要使用openGL在C++中制作一个具有平滑边角和光滑边缘的立方体.据我所知,我有三种选择:Bezier曲线(也许,是否可能?),一个带有圆柱体的圆柱体和角落的球体,或者加载一个立方体的.3ds.

有任何想法吗?

c++ opengl bezier

5
推荐指数
1
解决办法
1799
查看次数

完美转发模板参数包到emplace_back-编译失败

抱歉,如果在类似问题中有解决方案,我无法找到错误输出/问题类似的解决方案。

我正在尝试编译以下代码:

#include <vector>
using namespace std;

template< typename value_type >
class obj
{
    vector<value_type> m_v;
  public:

    template<class... vaList_t>
    void _emplace_back(vaList_t&&... i_values)
    {
        m_v.emplace_back( forward<vaList_t>(i_values)... );
    }
};

int main()
{
  obj<int> thing;
  thing._emplace_back(1,2,3,4);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

但是,它无法使用以下命令进行编译:

    In file included from /usr/include/x86_64-linux-gnu/c++/4.9/bits/c++allocator.h:33:0,
                 from /usr/include/c++/4.9/bits/allocator.h:46,
                 from /usr/include/c++/4.9/vector:61,
                 from 1:
/usr/include/c++/4.9/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int; _Args = {int, int, int, int}; _Tp = int]':
/usr/include/c++/4.9/bits/alloc_traits.h:253:4:   required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& …
Run Code Online (Sandbox Code Playgroud)

templates variadic-templates perfect-forwarding c++11 c++14

2
推荐指数
1
解决办法
696
查看次数