Skip to content

ezStringBuilder assignment operator alters the state of its const argument #2

@Manuzor

Description

@Manuzor
void ezStringBuilder::operator=(const ezStringIterator& rhs)

Even though the signature states, that rhs is const, the state of rhs is still altered, at least for some input.

The following sample reprocudes the issue:

auto builder = ezStringBuilder();
auto iter = ezStringIterator();

builder.Format("%u%u%u", 1, 2, 3); // "123"

iter = builder.GetIteratorFront(); // "123"
++iter;                            // "23"

builder = iter;

printf("builder: %s\n", builder.GetData());
printf("iter: %s\n", iter.GetData());

Output:

builder: 23
iter: 3

Expected Output:

builder: 23
iter: 23

I have compiled all my code and the ezEngine components using Visual Studio 2013 (Platform Toolset v120) in x64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions