Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //test1.cpp
- #include <iostream>
- #include "test.hpp"
- int main() {
- std::cout << foo<int>::bar.value << '\n';
- void f();
- f();
- std::cout << foo<int>::bar.value << '\n';
- }
- //test2.cpp
- #include "test.hpp"
- void f() {
- foo<int>::bar.value = 42;
- }
- // test.hpp
- struct wrapped { int value; };
- template <typename>
- struct foo {
- static wrapped bar;
- };
- template <typename T> wrapped foo<T>::bar = { 0 };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement