Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
vector的<<重载函数补充模板类
template<class T>vector相加+重载函数+列表的逐元素加法使用
using+decltype获取相加后的类型,随后创建新类型的vector再for循环相加variant中具体类型的加法使用
visit+lambda表达式得到+左右两个变量的类型,由于vector的加法在2中实现,故直接返回a+bvariant中具体类型的打印也需要通过
visit+lambda表达式得到variant中的具体类型,然后给os,随后返回osmain()中有variant<vector<int>, vector<double>>和variant<double>的加法,由于原程序中未实现,因此实现了variant<T1, T2> const &b, T2 const &a的加法,而且需要考虑参数顺序,否则还需要写一个重载函数(暂时未想到如何不考虑顺序);且若是variant<vector<int>, vector<double>>和variant<int>的加法,则仍需做相应的加法重载,main()中没调用,就不再实现。