Skip to content

Improve Constructors #35

@dbahrdt

Description

@dbahrdt

All classes should have the follow two constructors:

///Does not consume the data
///Data begins at d[0]
CTOR(UByteArrayAdapter const & d, NoConsumeTag)


///Does consume the data
///Data begins at d[0]
///d is altered such that after completion of CTOR
///d[0] points to one beyond the class data
CTOR(UByteArrayAdapter & d, ConsumeTag)

This makes it possible to write the following code:

CTOR(UByteArrayAdapter & d, ConsumeTag t) :
m_member1(d, t),
m_member2(d, t),
m_member3(d, t)
{
  whatever = d.getUint8();
  d >> whatever2;
  d.shrinktoGetPtr();
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions