struct A template {typedef float atype; typedef typename tB :: btype typeB; }; template struct B {typedef float btype; typedef typename tA :: atype typeA; };
struct MyB; struct MyA: public A<MyB>{}; struct MyB: public B<MyA>{}; int main(int argc, char *argv[]) { }
does not compile because "main.cpp: 6: error: invalid use of incomplete type 'struct MyB".
Basically, the compiler cannot solve the loop because the definition of A depends on the definition of B and vice versa. Is there any way to figure this out? thank,
. ( ), : ++: " " ?
: , , ( , ).
, , typedef'ing tB:: btype, struct MyB, ( ). : , tA:: atype struct B, , typedef typeB struct A, .
, , ?
, , , . ( ). , myA myB, , , myA, , , myB .. - ...
: , , ( ). , , AST, , - - , myA:: myB:: myA:: myB:: myA:: myB:: myA:: myB... myB:: btype ( myA::atype, myA::tA myB::tB) . , , , .
myA::atype
myA::tA
myB::tB
Source: https://habr.com/ru/post/1736328/More articles:LoadOperation.Completed against callback in DomainContext.Load () - silverlight-3.0Каковы эквиваленты Java в словах С# 'is' и 'as'? - javaBuying iphone in the app - iphoneWhat settings allow my application to control battery life? - androidHow easy is it to convert an application from Visual Foxpro 6 to Visual Foxpro 9? - visual-foxproКак объявить постоянный набор, видимый для каждого экземпляра класса? - javaHide items and "View more" with jQuery - javascripthibernate - Postgres mailing lists can contain a maximum of 1664 entries - postgresqlBinary trees in C - cviewWillAppear not called in UITableViewController? - iphoneAll Articles