小编Sam*_*nek的帖子

docker-compose - 服务“卷”必须是映射而不是数组

在将此问题标记为重复之前,我查看了很多线程,但没有一个线程能解决问题。

这是我的 docker 撰写文件:

version: '3'

services:
  # nginx
  nginx:
    build : ./nginx
    volumes: 
      - ./site:/var/www/html
    ports:
      - '8080:80'
    depends_on:
      php
  # database
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: bedrock123
      MYSQL_DATABASE: xyz
      MYSQL_USER: iamuser
      MYSQL_PASSWORD: iampass
    networks:
      - wpsite

  # php
  php:
    image: php:latest
  volumes:
    - ./site:./var/www/html
Run Code Online (Sandbox Code Playgroud)

我知道可能存在缩进错误,并且我确实检查了它们,但这似乎并不能解决问题。

docker

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

不能对 typedefed 模板使用 STL 函数

我创建了一个typedefformap但不能使用该find方法。这是代码:

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main()
{
    typedef std::map<std::string, int> customType;
    customType mod;

    mod["something"] = 2;

    if (mod.find("something"))
    {
        std::cout << "found";
    }
}
Run Code Online (Sandbox Code Playgroud)

对于上面的代码,我收到如下错误:

main.cpp: In function ‘int main()’:
main.cpp:22:17: error: could not convert ‘mod.std::map<_Key, _Tp, _Compare, _Alloc>::find, int, std::less >, std::allocator, int> > >(std::basic_string(((const char*)"something"), std::allocator()))’ from ‘std::map, int>::iterator {aka std::_Rb_tree_iterator, int> >}’ to ‘bool’
     if (mod.find("something"))
         ~~~~~~~~^~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)

我知道我可以直接使用std::map而没有,typedef但这段代码只是我想在项目中做的事情的一个例子。请帮助我找到使用该find方法的方法。

c++

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

标签 统计

c++ ×1

docker ×1