`
aigo
  • 浏览: 2722818 次
  • 性别: Icon_minigender_1
  • 来自: 宜昌
社区版块
存档分类
最新评论
文章列表
  官方文档: Visual Studio 2015 - Analyze Performance While Debugging in Visual Studio 2015 https://msdn.microsoft.com/en-us/magazine/dn973013.aspx    
  std::array中的元素必须在编译期间就要初始化,否则会出现一下错误: error C2280: 'std::array<>::array(void)': attempting to reference a deleted function   std::array正确的使用方法如下: std::array<int, 3> a1{ {1, 2, 3} };   如果元素是动态添加的,使用std::vector。   总结:std::vector相当于java中的ArrayList;而std::list相当于java中的LinkedList;s ...
UDP vs TCP, how much faster is it? http://stackoverflow.com/questions/47903/udp-vs-tcp-how-much-faster-is-it   其中这段话是重点: In some applications TCP is faster (better throughput) than UDP.   This is the case when doing lots of small writes relative to the MTU size. For exampl ...
vs2010中的hash_map调用方式: 需要头文件<hash_map>和命令空间stdext,且需要为不同key类型定义相应的comparator #include <hash_map> using namespace stdext; struct intLess : public std::binary_function<const int, const int, bool> { public: result_type operator()(const first_argument_type& _Left, co ...
vs2015 update 2对安全检测越来越严格了,以前很多只是warning的接口,现在都会直接给error,今天碰到了这种问题:   Error C4503 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>::_Insert': decorated name length exceeded, name was truncated   原因是我使用了多层嵌套的std::unordered_map(换成std ...
网上查了一下,大概时间表是这样的: android ndk从2013年开始支持了C++11,从2015年开始支持C++14。   设置方法:   1、支持标准: 在 Android.mk 中加入 ① c++ 11 标准: LOCAL_CPPFLAGS += -std=c++11 ② c++ 14标准: LOCAL_CPPFLAGS += -std=c++1y   2、支持STL: 在Application.mk中加入: APP_STL := gnustl_static     3、支持线程库: 当增加c++11或者c++14标准后,ndk就已经支持了thre ...
  如果在build.cs构建配置中添加如下代码: RulesCompiler.GetModuleFilename()   则编译时会出现警告或错误(preview版本中貌似不允许你使用直接提示error,正式版允许你编译通过但是会提示此API已经废除掉了): warning CS0612: 'UnrealBuildTool.RulesCompiler.GetModuleFilename(string)' is obsolete   解决办法: 演示例子是获取第三方库的目录的(假设../../ThirdParty/是我们工程存放第三方库的位置) using System.I ...
  原文: What's the algorithm behind sleep()? http://stackoverflow.com/questions/175882/whats-the-algorithm-behind-sleep    
  使用std::condition_variable时出现以下编译错误: SeverityCodeDescriptionProjectFileLineSuppression State ErrorC3892'u': you cannot assign to a variable that is const boost\lockfree\detail\copy_payload.hpp29   原因: condition_variable.wait中的内部类的参数默认是const,如果需要做修改,需要添加取地址符。   例子: std::mutex m; std::cond ...
  Golang lock-free values with atomic.Value https://texlution.com/post/golang-lock-free-values-with-atomic-value/    
key word:std::mutex、std::atomic、benchmark、performance   原文作者:@玄冬Wong   测试案例:8个线程分别执行1250万次累加和累减,累加的最终结果为10亿,累减的最终结果为0。   /************************************************************************/ /*测试std::mutex和std::atomic的性能对比 */ /********************************************************** ...
原文作者:@玄冬Wong key word:Non-blocking、Blocking、multi-productor、multi-customer、benchmark、performance   /************************************************************************/ /* 测试多个生产者多个消费者线程环境下,boost::lockfree::queue和std::mutex的性能 */ /********************************************************* ...
  FMath::CeilLogTwo(uint32 value) 含义:返回大于等于value的以2为底数的最大N次幂的指数N(是指数,不是幂)。 例子:value=15,返回值为4,因为16是大于等于15的2的N次幂当中最小的次幂,其对应的指数为4。   FMath::FloorLog2(uint32 value) 含义:与CeilLogTwo函数相反,返回小于等于value的以2为底数的最小N次幂的指数N。 例子:value=15,返回值为3,因为8是小于等于15的2的N次幂当中最大的次幂,其对应的指数为3。   FMath::IsPowerOfTwo<T> ...
  UE4工程的debug模式链接boost的时候出现错误: UE4  boost error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in    以下是UE4源码的注释,意思是说UE4编译器在编译debug版本的时候仍然会链接release版本的第三方库,因为UE4的编译器不支持在调试debug版本的第三方库。   // By default we use the Release C++ Runtime (CRT), even when c ...
  例如,求出大于或等于12、13、15等数值的最小2的次幂:16;同理,大于等于5、6、7的最小次幂为8。   //v必须是一个32位整数 int roundup_power_of_2(unsigned int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }   更多位相关算法: http://graphics.stanford.edu/~sea ...
Global site tag (gtag.js) - Google Analytics