ARMmbed / core-util

DEPRECATED: Mbed 3 utilities library
Other
12 stars 17 forks source link

Added Array #6

Closed bogdanm closed 9 years ago

bogdanm commented 9 years ago

Array is a simple container class that can be accessed using indexes (array[i]). It can grow automatically and is reentrant.

bogdanm commented 9 years ago

@0xc0170 , @autopulated , new Array implementation is here!

bogdanm commented 9 years ago

I'm going to wait a bit more, then merge this.

autopulated commented 9 years ago

:+1: apart from typo. mayyyyyybe a "capacity" function would make more sense than get_num_zones in the public API too, but whatever.

bogdanm commented 9 years ago

Thanks, I'll fix the typo. I share your thoughts about get_num_zones, but I feel that's needed for testing, and I don't have a good way to do public_for_testing_only: :) I'll add get_capacity though.

autopulated commented 9 years ago

yeah I guess some sort of #ifdef WE_ARE_TESTING_ETC would be useful, or even a macro to do test_visibility: in the class declaration. Although that would only work OK in headers pulled into tests. You wouldn't be able to compile a library differently for testing vs. not. because we don't currently recompile dependencies differently for your tests and main application, and I'm not sure that would even be a good idea.

bogdanm commented 9 years ago

There's a simpler, less hack-ish way, but the result looks weird: derive an ArrayForTesting class from Array and add the test-only methods there. But yeah, that's creepy.