问题列表 - 第318040页

RCThirdPartyFabricComponentsProvider.mm 找不到构建输入文件React Native

我的应用程序正在运行,当我尝试使用 xcode 构建时,突然开始出现此错误。我真的很感激任何帮助

我清理了构建文件夹,删除了派生数据内容,但仍然遇到相同的问题

native reactjs

7
推荐指数
1
解决办法
1260
查看次数

我不明白为什么编译器会这样

在处理引用时,我试图“探索”c++ oop 中的不同情况,但出现了一些奇怪的情况。输出是“31 20”,我确实希望它是这样的。

这是完整版本:

#include <iostream>

using namespace std;

class Persoana {
public:
    int varsta;

    Persoana(int v = 30) : varsta(v) {}
};

class Profesor {
public:
    int marca = 100;
    int varsta;

    Profesor(int v = 20) : varsta(v) {}

    operator Persoana() {
        Persoana p;
        p.varsta = varsta;
        return p;
    }

};
Persoana f(Persoana &p){
    p.varsta++;
    return p;
}

int main(){
    Persoana p;
    f(p);
    cout<<endl<<p.varsta;
    Profesor prof;
    f((Persoana&)prof);
    cout<<" "<<prof.varsta;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

然而,真正的问题在于这一行:

f((Persoana&)prof);

//A p object is …
Run Code Online (Sandbox Code Playgroud)

c++ reference

-4
推荐指数
1
解决办法
134
查看次数

如何让 from_str_radix 识别负十六进制数

这段代码

fn main() {
   let hex="ffffffff";
   let num = i32::from_str_radix(hex,16).unwrap();
   println!("{}", num);
}
Run Code Online (Sandbox Code Playgroud)

未能说明结果数字太大,无法容纳 i32

反之

println!("{:08x}", -1i32);
Run Code Online (Sandbox Code Playgroud)

但是会产生“ffffffff”

我是否缺少一些简单的东西,或者我是否必须陷入一些诡计

rust

0
推荐指数
1
解决办法
77
查看次数

C++ std::array 迭代器是否保证是类似指针的?

我有一个 C++ 数组:

std::array<int, 10> arr { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Run Code Online (Sandbox Code Playgroud)

我想反转最后五个元素,最终得到{ 0, 1, 2, 3, 4, 9, 8, 7, 6, 5 }. 我知道std::array给了我随机访问迭代器,所以我绝对可以这样写:

std::reverse(arr.begin() + 5, arr.end());
Run Code Online (Sandbox Code Playgroud)

但是,我想知道其他一些可能的方法。

T*是一个随机访问迭代器,所以我可以这样写:

std::reverse(&arr[5], &arr[arr.size()]);
Run Code Online (Sandbox Code Playgroud)

我相当确定这是明确定义的,因为允许引用(但不能访问)数组的末尾一位。

我想知道是否允许这样做:

std::reverse(&arr[5], arr.end());
Run Code Online (Sandbox Code Playgroud)

这在我的机器上运行,但这并不意味着它是标准行为。

如果arr是一个C风格的数组T[],那么它的迭代器类型显然是T*。但是,至少粗略地看一下,我没有看到任何与它std::array<T, C>::iterator相同的保证T*,甚至可以与之相媲美。

标准是否保证上述代码行有效?s是否保证与指向数组中元素的std::array<T, C>::iterator指针兼容?T

c++ arrays pointers iterator

2
推荐指数
1
解决办法
154
查看次数

VisionOS - 如何删除按钮背景?

我试图在 VisionOS 中创建一个圆形按钮,总是有一个椭圆形背景,在 iOS 版本中没有出现。我正在使用 SwiftUI 和 Xcode 15.2:

Button(action: {}) {
      Image(systemName: "arrow.up.circle.fill").resizable().frame(width: 50.0, height: 50.0)                                
}.background(Color.clear)
Run Code Online (Sandbox Code Playgroud)

更改背景没有效果,我想要的只是圆形,但按钮不断添加我不想要的椭圆形背景。我怎样才能摆脱这个背景?不需要的按钮的示例如下:

在此输入图像描述

PS:导航链接似乎也存在同样的问题,似乎也在那里设置了不需要的背景。任何指导将不胜感激。

visionos

3
推荐指数
1
解决办法
259
查看次数

如何将 for 循环与其主体中声明的向量相匹配?

我希望将所有 for 循环与在其主体中声明的向量相匹配(稍后可能会扩展到 while 循环和 do-while 循环):

\n
#include <vector>\n\nint main() {\n  for (int i = 0; i < 10; i++) {\n    std::vector<int> foo;\n  }\n\n  return 0;\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我从这个程序中得到的 AST 是

\n
`-FunctionDecl 0x55c1d33c8bc8 <main.cpp:3:1, line:9:1> line:3:5 main \'int ()\'\n  `-CompoundStmt 0x55c1d3402a48 <col:12, line:9:1>\n    |-ForStmt 0x55c1d34029e0 <line:4:3, line:6:3>\n    | |-DeclStmt 0x55c1d33c8d40 <line:4:8, col:17>\n    | | `-VarDecl 0x55c1d33c8cb8 <col:8, col:16> col:12 used i \'int\' cinit\n    | |   `-IntegerLiteral 0x55c1d33c8d20 <col:16> \'int\' 0\n    | |-<<<NULL>>>\n    | |-BinaryOperator 0x55c1d33c8db0 <col:19, col:23> \'bool\' \'<\'\n …
Run Code Online (Sandbox Code Playgroud)

c++ clang clang-ast-matchers clang-tidy

8
推荐指数
1
解决办法
130
查看次数

在四开本中运行块的一部分

我想知道是否可以运行代码块的一部分而不注释我们不想运行的行。例如我们有以下 qmd 文件:

---
title: "Run only part of code chunk without commenting"
---

```{r}
data(trees)
head(trees)

plot(Girth ~ Height, data = trees, pch=16)
mod <- lm(Girth ~ Height, data = trees)

summary(mod)
```
Run Code Online (Sandbox Code Playgroud)

假设我们只想运行第 6 行到第 9 行,我们该怎么做呢?我不想使用这样的评论:

---
title: "Run only part of code chunk without commenting"
---

```{r}
data(trees)
head(trees)

plot(Girth ~ Height, data = trees, pch=16)
#mod <- lm(Girth ~ Height, data = trees)

#summary(mod)
```
Run Code Online (Sandbox Code Playgroud)

这样做的主要原因是我想显示完整的代码但不想运行所有代码。当我们对某些行进行评论时,看起来不太好。所以我想知道是否有人知道这是否可能Quarto?

r quarto

3
推荐指数
1
解决办法
100
查看次数

无法访问seaborn示例数据集

我试图使用来自seaborn的“tips”数据集:

import seaborn as sns
tips = sns.load_dataset("tips")
Run Code Online (Sandbox Code Playgroud)

我得到了这个错误:

ValueError                                Traceback (most recent call last)
Cell In[5], line 1
----> 1 a = sns.load_dataset("anagrams")
      2 a.info()

File C:\anaconda3\lib\site-packages\seaborn\utils.py:587, in load_dataset(name, cache, data_home, **kws)
    585 if not os.path.exists(cache_path):
    586     if name not in get_dataset_names():
--> 587         raise ValueError(f"'{name}' is not one of the example datasets.")
    588     urlretrieve(url, cache_path)
    589 full_path = cache_path

ValueError: 'anagrams' is not one of the example datasets.
Run Code Online (Sandbox Code Playgroud)

然后我尝试:

sns.get_dataset_names()

输出是一个空列表:[]

我可以使用seaborn图。我还尝试使用以下方法更新我的seaborn:

!pip install seaborn --upgrade

但这没有帮助。

能否请你帮忙?

python dataset seaborn

4
推荐指数
1
解决办法
554
查看次数

QMutex:销毁 Qt 线程中锁定的互斥体

我的 Qt 应用程序面临涉及线程和 QMutex 的问题。我有一个运行循环的 QThread 子类,并且我使用 QMutex 来处理线程同步。但是,我不断在控制台中收到错误消息“QMutex:销毁锁定的互斥体”。

这是我的代码的简化版本:

// mythread.h
#ifndef MYTHREAD_H
#define MYTHREAD_H

#include <QThread>

class MyThread : public QThread
{
    Q_OBJECT
public:
    MyThread();
    void run();
    bool Stop ;

signals:
    void NumberChanged(int);
};

#endif // MYTHREAD_H
Run Code Online (Sandbox Code Playgroud)
#include "mythread.h"
#include <QtCore>
#include <QDebug>
MyThread::MyThread() {}


void MyThread::run(){
    for(int i = 0; i<10000;i++){

        QMutex mutex;
        mutex.lock();
        if (this->Stop) {break;}
        mutex.unlock();

        emit NumberChanged(i);
    }
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,我遇到了“QMutex:破坏锁定的互斥体”错误。我根据网上的建议尝试了不同的方法,但问题仍然存在。

有人可以帮我找出问题并提出解决方案吗?我很感激任何见解或指导。谢谢你!

c++ qt

0
推荐指数
1
解决办法
84
查看次数

根据预定义范围计算列的行和

我有一个与此类似的数据集:

  dataset <- structure(
list(
Participant.Id = 1:5,

x1 = c(10L, 20L, 30L, 40L, 50L),
x2 = c(15L, 25L, 35L, 45L, 55L),
x3 = c(20L, 25L, NA, 45L, NA),
x4 = c(25L, 30L, NA, 50L, NA),
x5 = c(NA, 35L, NA, 55L, NA),
x6 = c(NA, 35L, NA, NA, NA),

y1 = c(10L, 20L, 30L, 40L, 50L),
y2 = c(15L, 25L, 35L, 45L, 55L),
y3 = c(20L, 25L, NA, 45L, NA),
y4 = c(25L, 30L, NA, 50L, NA),
y5 = …
Run Code Online (Sandbox Code Playgroud)

r data-manipulation dataframe dplyr

6
推荐指数
1
解决办法
125
查看次数