複数の翻訳単位で、既定のテンプレート引数は異なるが同じ定義を持つ同じテンプレートの宣言を行うことはできますか? たとえば、b.cpp
との翻訳単位c.cpp
が一緒にリンクされている場合、次のコードは ODR に違反しますか?
// a.hpp
template <bool> class x {...};
// b.cpp
template <bool = true> class x;
#include "a.hpp"
// uses of x<>
// c.cpp
template <bool = false> class x;
#include "a.hpp"
// uses of x<>