centos7安装aria2-1.34.0 解决bignum.h make_unique 错误问题

1.下载并解压最新的aria2   https://github.com/aria2/aria2/tags

wget https://github.com/aria2/aria2/releases/tag/release-1.34.0/aria2-1.34.0.tar.gz 
tar -jxv -f aria2-1.34.0.tar.gz 

2.编译

进入解压目录

make

make install

3.解决bignum.h   make_unique 错误  加上如下代码

#include <memory>
#include <stdint.h>
#include <iostream>
#include <utility>
#include <type_traits>


 template<bool, typename _Tp = void>
 struct enable_if{ };

 template<typename _Tp>
 struct enable_if<true, _Tp>
 { typedef _Tp type; };
 // 普通指针
 template<class T,class... Args> inline
 typename enable_if<!std::is_array<T>::value,std::unique_ptr<T>>::type
 make_unique(Args&&... args){
     return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
// 动态数组
template<class T> inline
typename enable_if<std::is_array<T>::value && std::extent<T>::value == 0,std::unique_ptr<T>>::type
make_unique(size_t size){
    typedef typename std::remove_extent<T>::type U;
    return std::unique_ptr<T>(new U[size]());
}
// 过滤掉定长数组
template<class T,class... Args>
typename enable_if<std::extent<T>::value != 0,void>::type
make_unique(Args&&...) = delete;

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值