note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'const long long int' { return __val < *__it; }
时间: 2024-04-22 22:24:05 浏览: 13
根据你提供的错误信息,问题出现在 `operator<` 函数中。这个错误通常是由于比较运算符的两个操作数类型不匹配导致的。
在你的代码中,你定义了一个 `operator<` 函数,但是它的参数类型是 `const long long&`,而 `upper_bound` 函数的返回类型是迭代器类型,与 `const long long&` 不匹配。
解决这个问题的方法是修改 `operator<` 函数的参数类型,使其与 `upper_bound` 函数的返回类型匹配。你可以将 `operator<` 函数的参数类型改为迭代器类型,如下所示:
```cpp
bool operator<(const que& other) const { return data < other.data; }
```
请根据上述修改尝试重新编译你的代码,看看是否能够解决这个错误。如果还有其他问题,请随时告诉我!
相关问题
name_classes = [""] ^ IndentationError: unexpected indent
IndentationError: unexpected indent usually occurs when there is an extra indentation or mismatched indentation in your code. In the code snippet you provided, it seems that you have an extra indentation before the line `name_classes = [""]`. To fix this error, make sure that all lines of code within the same block have consistent indentation. Here's an example of how the code should look without the error:
```python
name_classes = [""]
```
Make sure that the line `name_classes = [""]` has the same indentation as the surrounding code.
Invalid operation: exp * time.Second (mismatched types int and Duration)
这个错误通常是因为您正在尝试将一个整数乘以一个时间持续时间。请确保您正在使用正确的类型,或将整数转换为时间持续时间。例如,您可以将整数转换为 `time.Duration` 类型,然后将其乘以时间单位,如下所示:
```
import "time"
func main() {
duration := 5 * time.Second
fmt.Println(duration)
}
```
这将在控制台上输出 `5s`。