libcamera: utils: Add to_underlying() helper function
C++23 has a std::to_underlying() helper function that converts an enumeration value to its underlying type. Add a compatible implementation to the libcamera::utils namespace. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
This commit is contained in:
@@ -521,6 +521,16 @@ double strtod(const char *__restrict nptr, char **__restrict endptr)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn to_underlying(Enum e)
|
||||
* \brief Convert an enumeration to its underlygin type
|
||||
* \param[in] e Enumeration value to convert
|
||||
*
|
||||
* This function is equivalent to the C++23 std::to_underlying().
|
||||
*
|
||||
* \return The value of e converted to its underlying type
|
||||
*/
|
||||
|
||||
} /* namespace utils */
|
||||
|
||||
#ifndef __DOXYGEN__
|
||||
|
||||
Reference in New Issue
Block a user