Book a Demo

Author Topic: Associations in c++ without pointers  (Read 2744 times)

henrikbe

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Associations in c++ without pointers
« on: August 26, 2010, 06:35:25 pm »
Hi,

is it possible to tell EA not to use pointers for associations?

For example, I have a 1:n association between class A and class B. I want this to be represented as a std::vector<B> member of class A. I set the following default collection class for C++:

std::vector<#TYPE#>

But what I get in A.h is

std::vector<B> *m_B;

What I would like to get is

std::vector<B> m_B;

How can I achieve this?

Henrik

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Associations in c++ without pointers
« Reply #1 on: August 26, 2010, 06:43:12 pm »
Have you tried to set the containment of the role from "Reference" or "Unspecificed" to "Value"?

Geert

henrikbe

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Associations in c++ without pointers
« Reply #2 on: August 26, 2010, 06:49:32 pm »
Thank you, that worked!

A somewhat related question: What if I wanted the type to be std::vector<A*>, that is, a vector of pointers? I suppose I could set the Collection Class to std::vector<#TYPE#*>, but are there any more elegant ways to achieve this? Like setting an attribute of the role or something?

Henrik