I have the following code: enum foo { null_foo, foo1, foo2 };
template<typename T> struct data { T val; bool set; template<typename U> data<T>& operator=(const U &that) { val = that; set = true; return *this; } }; struct foo_1 { }; struct foo_2 { }; template<typename T> struct map_foo_type { static foo const id = null_foo; }; // worst match template<> struct map_foo_type<foo_1> { static foo const id = foo1; }; template<> struct map_foo_type<foo_2> { static foo const id = foo2; }; Using the above code, I want to be able to do the following: data<int> mid = map_foo_type<foo1>::id; When I compile with gcc 3.3.6 I get a linker error - undefined symbol mep_foo_type<foo1>::id If I have an intermediate step: foo id = map_foo_type<foo1>::id data<int> mid = id; then it links fine. Alternately, if I change operator= above to take const U data, rather than a reference to const U, it also links fine! What is the problem please? Thanks Steve _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus