How to implement filterMap

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Dec 30 01:22:31 UTC 2023


On Friday, 29 December 2023 at 23:10:47 UTC, Christian Köstlin 
wrote:
> Is there a way to implement filterMap (meaning do mapping of a 
> range, but if something happens during the map, leave this 
> element out of the resulting range).

It's probably not a good idea to do this in general. Expecting a 
lot of exceptions handling happening during normal program 
execution (if you want to filter out roughly half of the input 
array) will result in a major performance loss. Exceptions are 
best left to just do error handling on a very rarely used code 
path for troubleshooting purposes.


More information about the Digitalmars-d-learn mailing list