Boost logo

Boost Users :

Subject: [Boost-users] Indirectly 'recursive' type erasure
From: Samuel Christie (schrist_at_[hidden])
Date: 2014-03-06 19:01:39

I'm trying to create a type erasure concept for a type that has a member
function which can return a custom collection of itself.

Having had little luck with the general formulation, I tried simplifying it

BOOST_TYPE_ERASURE_MEMBER((has_collection), collection, 0);

typedef any<
> test;

class Test {
  vector<test> collection();

However, I get conversion errors if the Test::collection method returns
either vector<Test> or vector<test>; it only seems to match if I have it
literally return vector<_self>, which implies to me that I'm not
understanding what I'm doing, and that _self isn't getting substituted in
this case.

What do I need to do in order to be able to return types that are dependent
on the erasure type? My actual code uses a more indirect relationship, with
the collection method returning a custom erased collection type that has an
erased iterator that can dereference to the equivalent of Test. However,
since there is still a form of cyclic dependency, I'm not really sure what
I can do about it. I've tried using a custom struct based concept that had
direct template arguments in the place of 'boost type erasure member', but
I think I understand that technique even less, and it didn't seem to help

It looked like there might be something useful under the Associated Types
section of the type erasure documentation, but I couldn't quite figure it

Any assistance would be most helpful.



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at