Replace SFINAE with concepts (#5361)

Concepts are cleaner to use and result in much better error messages for incorrect template use.
This commit is contained in:
Tyler Veness
2023-06-07 09:50:09 -07:00
committed by GitHub
parent d57d1a4598
commit 91cbcea841
42 changed files with 397 additions and 361 deletions

View File

@@ -8,6 +8,7 @@
#include <string_view>
#include <wpi/StringMap.h>
#include <wpi/concepts.h>
#include "frc/smartdashboard/SendableChooserBase.h"
@@ -27,12 +28,9 @@ namespace frc {
* @see SmartDashboard
*/
template <class T>
requires std::copy_constructible<T> && std::default_initializable<T>
class SendableChooser : public SendableChooserBase {
wpi::StringMap<T> m_choices;
static_assert(std::is_copy_constructible_v<T>,
"T must be copy-constructible!");
static_assert(std::is_default_constructible_v<T>,
"T must be default-constructible!");
template <class U>
static U _unwrap_smart_ptr(const U& value);