Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<int a> struct bar;
- template<int a, int b> struct foo {
- operator bar<a> const (); // operator-based conversion
- };
- template<int a> struct bar : public foo<a, a> {
- bar() { }
- template<int b> bar(const foo<a, b>&) { } // constructor-based conversion
- };
- template<int a, int b> foo<a, b>::operator bar<a> const () { return bar<a>(); }
- template<int a> void f(bar<a> x, bar<a> y) { }
- int main() {
- bar<1> x;
- foo<1, 2> y;
- f(x, y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement