From e2be51083e1e8c61fab0094b876cd28e84d8a24a Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Tue, 20 Jan 2026 12:13:32 -0500 Subject: [PATCH] fix: make example router move-only fix #956 --- example/router/detail/router.hpp | 5 +++++ example/router/router.hpp | 6 +++++- test/unit/example/router/router.cpp | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/example/router/detail/router.hpp b/example/router/detail/router.hpp index 308b0881b..7a574b202 100644 --- a/example/router/detail/router.hpp +++ b/example/router/detail/router.hpp @@ -39,6 +39,11 @@ class router_base virtual ~router_base(); + router_base(router_base const&) = delete; + router_base& operator=(router_base const&) = delete; + router_base(router_base&&) noexcept = default; + router_base& operator=(router_base&&) noexcept = default; + void insert_impl( core::string_view s, diff --git a/example/router/router.hpp b/example/router/router.hpp index 86e6543a6..9e6357fa7 100644 --- a/example/router/router.hpp +++ b/example/router/router.hpp @@ -54,6 +54,11 @@ class router /// Constructor router() = default; + router(router const&) = delete; + router& operator=(router const&) = delete; + router(router&&) noexcept = default; + router& operator=(router&&) noexcept = default; + /** Route the specified URL path to a resource @param path A url path with dynamic segments @@ -88,4 +93,3 @@ class router #include "impl/router.hpp" #endif - diff --git a/test/unit/example/router/router.cpp b/test/unit/example/router/router.cpp index b46de7680..314dd3ebd 100644 --- a/test/unit/example/router/router.cpp +++ b/test/unit/example/router/router.cpp @@ -16,9 +16,20 @@ #include "test_suite.hpp" +#include + namespace boost { namespace urls { +static_assert(!std::is_copy_constructible>::value, + "router should be move-only"); +static_assert(!std::is_copy_assignable>::value, + "router should be move-only"); +static_assert(std::is_move_constructible>::value, + "router should support moves"); +static_assert(std::is_move_assignable>::value, + "router should support moves"); + struct router_test { static