[C++ Template]what is the type of instantiation of template function.

The book <<C++ templates>> said:
2011070611464919.png

however, in VS2008 and gcc 4.3, the compilers can deduce the type of parameter. The followed code has no compile error.
look here( http://ideone.com/yTpaJ ) for gcc result.
#include   <vector>
#include   <algorithm>
using   namespace   std;
template   < typename   T,   int   VAL>
T addValue (T   const & x) {
      return   x + VAL;
}
int   main( int   argc,   char * argv[])
{
      vector< int > source;
      vector< int > dest;
       int   (*funP)( int   const &);
      funP = addValue< int ,5>;
      std::transform (source.begin(), source.end(),    // start and end of source
                dest.begin(),                    // start of destination
                addValue< int ,5>);                // operation

      std::transform (source.begin(), source.end(),    // start and end of source
                dest.begin(),                    // start of destination
                funP);  
       return   0;
}

转载于:https://www.cnblogs.com/aoaoblogs/archive/2011/07/06/2099052.html

引用\[1\]和\[2\]中提到的错误"Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError"是由于在创建bean时发生了异常,导致bean的实例化失败。具体的原因可能是在bean的初始化过程中发生了错误,导致初始化器抛出了异常。这个错误通常是由于代码中的某些问题引起的,比如依赖冲突、配置错误等。 引用\[3\]中提到的错误"Instantiation of bean failed; nested exception is java.lang.AssertionError"可能是由于在创建bean时发生了断言错误,导致bean的实例化失败。断言错误通常是由于代码中的某些条件不满足而引发的。 要解决这个问题,你可以检查相关的代码和配置,确保没有依赖冲突或配置错误。另外,你还可以查看错误的堆栈跟踪信息,以了解更多关于错误的详细信息,从而更好地定位和解决问题。 #### 引用[.reference_title] - *1* [项目启动时报错Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError](https://blog.csdn.net/dissplay1/article/details/113719499)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Bean初始化错误:Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError](https://blog.csdn.net/qq_51515673/article/details/126643650)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [关于Initialization of bean failed; nested exception is java.lang.AbstractMethodError相关错误](https://blog.csdn.net/qq_45790384/article/details/117093468)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值