@@ -19,7 +19,7 @@ namespace zest {
1919 * @tparam Errs List of possible error types. Must inherit from ResultError.
2020 * Must contain at least 1 type. All types must be unique.
2121 */
22- template <typename T, traits::IsResultError... Errs>
22+ template <traits::NotResultError T, traits::IsResultError... Errs>
2323 requires traits::NotEmpty<Errs...> && traits::AllUnique<Errs...>
2424class Result {
2525 public:
@@ -35,7 +35,7 @@ class Result {
3535 * @tparam U Type convertible to T, and U not derived from ResultError
3636 * @param value Value to initialize the result with.
3737 */
38- template <typename U>
38+ template <traits::NotResultError U>
3939 requires std::convertible_to<U, T>
4040 constexpr Result (U&& value)
4141 : value(std::forward<U>(value)),
@@ -48,7 +48,7 @@ class Result {
4848 * @param error Error to store.
4949 * @note Requires T to have a defined sentinel value (via SentinelValue<T>).
5050 */
51- template <typename U, traits::IsResultError E>
51+ template <traits::NotResultError U, traits::IsResultError E>
5252 requires std::convertible_to<U, T> && traits::InPack<E, Errs...>
5353 constexpr Result (U&& value, E&& error)
5454 : value(std::forward<U>(value)),
@@ -94,7 +94,7 @@ class Result {
9494 * - The fallback value must be convertible to the value type of the Result type returned by the
9595 * callable.
9696 */
97- template <typename Self, typename F, typename U>
97+ template <typename Self, typename F, traits::NotResultError U>
9898 requires std::invocable<F, decltype ((std::declval<Self>().value))>
9999 && traits::IsResult<traits::value_return_t <Self, F>>
100100 && traits::
@@ -181,7 +181,7 @@ class Result {
181181 * @param self the current Result instance
182182 * @param val the value to use if self contains an error
183183 */
184- template <typename Self, typename U>
184+ template <typename Self, traits::NotResultError U>
185185 requires std::convertible_to<U, T>
186186 constexpr T or_default (this Self&& self, U&& val) {
187187 if (self.has_error ()) {
0 commit comments