0

Very simple, is there any way for both A to refer to B::value_type, B refer to A::value_type?

struct B;

struct A {
    using value_type = int;
    value_type a;
    B::value_type b;
};

struct B {
    using value_type = int;
    value_type b;
    A::value_type a;
};

1 Answers1

0

Only in a very hackish way.

template<int> struct Z
{
    struct B;

    struct A {
        using value_type = int;
        value_type a;
        typename B::value_type b;
    };

    struct B {
        using value_type = int;
        value_type b;
        typename A::value_type a;
    };
};

using A = Z<0>::A;
using B = Z<0>::B;
n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243