C++相談室 part91
■ このスレッドは過去ログ倉庫に格納されています
0331デフォルトの名無しさん
2011/10/01(土) 10:34:55.80例えばこういうやり方はできる
/*swap.hpp*/
#ifndef SWAP_HPP
#define SWAP_HPP
template <typename T>
void swap(T& lhs,T& rhs);
#include <swap.inl>
#endif
/*swap.inl*/
template <typename T>
void swap(T& lhs,T& rhs)
{
T tmp(lhs);
lhs = rhs;
rhs = tmp;
}
cppはつまり具体的な型がないとコンパイルできない
■ このスレッドは過去ログ倉庫に格納されています