Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <opencv2/opencv.hpp>
- // Forward declaration
- class foo;
- class bar
- {
- public:
- bar() { }
- void link(cv::Ptr<foo> foo_in);
- private:
- cv::Ptr<foo> f;
- };
- class foo
- {
- public:
- foo() { }
- void link(cv::Ptr<bar> bar_in);
- private:
- cv::Ptr<bar> b;
- };
- void bar::link(cv::Ptr<foo> foo_in) {
- if (f != foo_in) {
- f = foo_in;
- f->link(cv::Ptr<bar>(this));
- }
- }
- void foo::link(cv::Ptr<bar> bar_in) {
- if (b != bar_in) {
- b = bar_in;
- b->link(cv::Ptr<bar>(this));
- }
- }
- int main(int argc, char** argv)
- {
- cv::Ptr<foo> f = new foo();
- cv::Ptr<bar> b = new bar();
- f->link(b);
- //b->link(f);
- return 0;
- }
- Unhandled exception ... Access violation reading location ...
Add Comment
Please, Sign In to add comment