Uploaded November 2020 | Updated September 2026, 2 weeks ago
I have written a version of std::optional called BasicOptional for the Arduino and I'm giving it away. If you want the library, here is a link:
https://1drv.ms/u/s!AoticBc4xuQQgTdegDKG5Aen2QW-?e=5DFcXg
My version implements some of the functions used on the 'optional' standard library in C++ but I may come back to this and expand upon it.
This is useful for functions that can either return something or fail to for example, you could have a function that converts string to a number. If the string is corrupted, it could return a 0 or a -1 but these are also valid numbers that could be in the string so what can we do in this scenario?
The Arduino does not have exception handling so an error cannot be reported. What you can do is return a ‘BasicOptional’ which contains the number or it is empty. You can run code if a number is contained within or you could supply your own default number if the function couldn’t decode the string.
The ‘optional’ class is used in C++17.
I have written a version of std::optional called BasicOptional for the Arduino and I'm giving it away. If you want the library, here is a link:
https://1drv.ms/u/s!AoticBc4xuQQgTdegDKG5Aen2QW-?e=5DFcXg
My version implements some of the functions used on the 'optional' standard library in C++ but I may come back to this and expand upon it.
This is useful for functions that can either return something or fail to for example, you could have a function that converts string to a number. If the string is corrupted, it could return a 0 or a -1 but these are also valid numbers that could be in the string so what can we do in this scenario?
The Arduino does not have exception handling so an error cannot be reported. What you can do is return a ‘BasicOptional’ which contains the number or it is empty. You can run code if a number is contained within or you could supply your own default number if the function couldn’t decode the string.
The ‘optional’ class is used in C++17.
![TV appearance BBC Dave Gorman Genius behind the scenes
I made a television appearance with Dave Gorman who has also made Modern Life is Goodish. I dont remember the episode but it was the second series. I rather enjoyed my experience at the BBC in London. This is the extra unused footage that I have taken. There were interviews with the famous celebrities Noddy Holder and Shappi Khorsandi too.
[ENGLISH] CHANGE THE VIDEO QUALITY by clicking on the gear icon (if you are having problems with buffering, lower it).
[ESPAÑOL] PUEDE CAMBIAR LA CALIDAD DEL VÍDEO. Si tiene problemas al reproducir un vídeo, haga clic en el icono de rueda dentada que aparece en la parte derecha del reproductor de vídeo y seleccione la calidad que prefiera.
[FRANÇAIS] ON PEUT MODIFIER LA QUALITÉ DE CETTE VIDÉO. Si vous rencontrez un problème lors de la lecture dune vidéo, cliquez sur licône représentant une roue dentée sous le côté droit du lecteur vidéo, puis sélectionnez la qualité qui vous convient. TV appearance BBC Dave Gorman Genius behind the scenes](https://i.ytimg.com/vi/vh3qNvYX7RU/mqdefault.jpg)









