Skip to content

sparse array #6

Description

@jakubo87

`TEST_F(SparseArrayTest, RandomAccess)
{
LOG_MESSAGE("SparseArrayTest.RandomAccess");

constexpr int N = 840 * NMULT;
sparse_array<int, N> sa;

auto it = sa.begin() + 621;

*it = 123;
ASSERT_EQ(it, std::find(sa.begin(), sa.end(), 123));

it += 100;
*it = 2340;
ASSERT_EQ(it, std::find(sa.begin(), sa.end(), 2340));
laut dem test könnte man an verschiedenen stellen denselben wert einfügen, was dann einem array entspräche... Ich dachte der Sinn sei es ein Wertepaar von Key und Value zu speichern, sodass dann N Werte gespeichert werden könnten mit indizes von 0 bis max(int), diese könnte man dann sortiert einfügen und bräuchte nicht lange suchen....
Verstehe daher den test mit dem Iterator und seiner Position nicht.
Grüße

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions