小编jel*_*mew的帖子

使用unique_ptr的C++数组char

首先,我知道这不是最好的方法,我只是看看应该怎么做.我创建了一个名为bord的类,它拥有一个成员

        std::unique_ptr<std::unique_ptr<char>[] > char_bord;
Run Code Online (Sandbox Code Playgroud)

哪个应该是正确的语法,然后我尝试在构造函数中初始化它:

bord::bord():char_bord(new std::unique_ptr<char>[10])
{
    //char_bord=new std::unique_ptr<char>[10]; //This did not seem to work aswell.
    for(int i=0;i<10;i++)
      char_bord[i]=new std::unique_ptr<char>[](new char[10]); 
    return;
}
Run Code Online (Sandbox Code Playgroud)

这会导致以下错误堆,我无法解密.

jelmer@jelmer-N56JN:~/Git/Board/lib$ g++ -std=c++0x bord.c
In file included from bord.c:1:0:
bord.h:20:1: error: new types may not be defined in a return type
 class bord
 ^
bord.h:20:1: note: (perhaps a semicolon is missing after the definition of ‘bord’)
bord.c:3:12: error: return type specification for constructor invalid
 bord::bord():char_bord(new std::unique_ptr<char>[10])
            ^
bord.c: In constructor ‘bord::bord()’:
bord.c:7:46: error: expected primary-expression …
Run Code Online (Sandbox Code Playgroud)

c++ unique-ptr c++11

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

来自 dev.azure.com 的 git clone (使用 ssh)突然要求输入密码

我遇到了一个不寻常的问题,当针对 azure-devops 运行 git 命令时,它会无缘无故地要求输入密码。比方说,我跑

git clone git@ssh.dev.azure.com:v3/oranization/project/repo
Run Code Online (Sandbox Code Playgroud)

然后它会问

git@ssh.dev.azure.com's password: 
Run Code Online (Sandbox Code Playgroud)

几周前它起作用了。我完全惊呆了,非常感谢任何帮助。我的 ssh 配置是

Host azure
  IdentityFile ~/.ssh/id_openshift_tst_rsa
  #IdentitiesOnly yes
  Hostname ssh.dev.azure.com
Host workid
  Hostname bitbucket.org
  IdentityFile ~/.ssh/id_rsa
Host personalid
  Hostname bitbucket.org
  IdentityFile ~/.ssh/id_own_bitbucket_rsa
Host devbox
  Hostname dev.bovaris.io
  User vagrant
  IdentityFile ~/.ssh/id_rsa
Host minishift
  Hostname 10.128.64.4
  User datalake
  IdentityFile ~/.ssh/id_minishift_azure_rsa
Host home 
  HostName jelmervanamen.nl
  User pi
Host homeServer
  HostName jelmervanamen.nl
  Port 2222
  User jelmer
  ProxyCommand ssh jelmer@home nc %h %p %r
Host babyPi
  IdentityFile ~/.ssh/id_rsa
  HostName babypi.local
  Port 22
  User …
Run Code Online (Sandbox Code Playgroud)

git ssh fedora azure-devops

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

file.getFileName().endsWith()没有检测到.mp3

我可能错过了一些小东西,但我找不到它.使用file.getFileName().endsWith(".mp3"),布尔值始终为false.如果我将te文件重命名为*.mp并将代码更改为endsWith(".mp"),则会找到它们.这里发生了什么?

问候,Jelmew

编辑:文件是一个路径对象顺便说一句.

文件名:

/home/jelmer/Music/01 - Nightwish - Shudder Before The Beautiful.mp3
/home/jelmer/Music/02 - Nightwish - Weak Fantasy.mp3
/home/jelmer/Music/03 - Elan (Album Version).mp3
/home/jelmer/Music/04- Nightwish - Yours Is An Empty Hope.mp3
/home/jelmer/Music/05 - Nightwish - Our Decades In The Sun.mp3
/home/jelmer/Music/06 - Nightwish - My Walden.mp3
/home/jelmer/Music/07 - Nightwish - Endless Forms Most Beautiful.mp3
/home/jelmer/Music/08 - Nightwish - Edema Ruh.mp3
/home/jelmer/Music/09 - Nightwish - Alpenglow.mp3
/home/jelmer/Music/10 - Nightwish - Eyes Of Sharbat Gula.mp3
/home/jelmer/Music/11 - Nightwish - The Greatest Show …
Run Code Online (Sandbox Code Playgroud)

java

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

标签 统计

azure-devops ×1

c++ ×1

c++11 ×1

fedora ×1

git ×1

java ×1

ssh ×1

unique-ptr ×1