sandeepmistry / arduino-BLEPeripheral

An Arduino library for creating custom BLE peripherals with Nordic Semiconductor's nRF8001 or nR51822.
MIT License
462 stars 179 forks source link

Add value_type member to BLETypedCharacteristic #210

Closed dsanders11 closed 3 years ago

dsanders11 commented 6 years ago

Simple change that adds a typedef named value_type to BLETypedCharacteristic. This pattern is common in the STL, and it's nice because especially in C++11 you can easily get the type of a variable with decltype, and then get access to the value type.

Example usage (and reason I added it):

static_assert(sizeof(BLEShortCharacteristic::value_type) == 2, "Short must be 2 bytes");
sandeepmistry commented 6 years ago

@dsanders11 thanks for submitting.

Other that the assert mentioned above, what practical usage would this have in an Arduino sketch or library?