我不明白为什么代码会这样?
#include <iostream>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/include/vector.hpp>
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/include/vector_fwd.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/include/make_vector.hpp>
#include <boost/fusion/sequence/io.hpp>
#include <boost/fusion/include/io.hpp>
template<typename Ar>
void func(Ar& ar, const boost::fusion::vector<>& v) {
std::cout << v << std::endl;
}
template<typename Ar, typename T0, typename T1>
void func(Ar& ar, const boost::fusion::vector<T0, T1>& v) {
std::cout << v << std::endl;
}
struct type {
template<typename T>
type& operator& (const T& v) {
func(*this, v);
return *this;
}
};
int main() {
type t;
t & boost::fusion::make_vector(33,44); // 1. <<<<<<<<<<<<<<<<<<<<<<<<
boost::fusion::vector<int, int> v(55,66); // 2.
t & v;
}
问题是,为什么在第一种情况下调用空向量的 func() ?
关于此主题的文档:
谢谢。