我想学习C++中的多线程,但我不确定哪种类型最有用.我看过教程的是:
(我确信可能还有更多.)
每个人的主要特征是什么,它们最适合用于什么?
注意:我已经通过手动创建线程在C#中完成了一些多线程,线程的更复杂性只会让它变得更有趣.:)
我需要使用openGL在C++中制作一个具有平滑边角和光滑边缘的立方体.据我所知,我有三种选择:Bezier曲线(也许,是否可能?),一个带有圆柱体的圆柱体和角落的球体,或者加载一个立方体的.3ds.
有任何想法吗?
抱歉,如果在类似问题中有解决方案,我无法找到错误输出/问题类似的解决方案。
我正在尝试编译以下代码:
#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)