C++11 映射和共享\u ptr错误:'\u d'不能用作函数

C++11 映射和共享\u ptr错误:'\u d'不能用作函数,c++11,map,copy,shared-ptr,C++11,Map,Copy,Shared Ptr,我正在尝试将域名映射到OpenSSL上下文对象 using SSL_CTX_ptr = std::shared_ptr<SSL_CTX>; typedef map<string, SSL_CTX_ptr> DomainContexts; ... static DomainContexts contexts; ... string domain = "example.com" SSL_CTX_ptr ctx(CreateServerContext(domain), ::

我正在尝试将域名映射到OpenSSL上下文对象

using SSL_CTX_ptr = std::shared_ptr<SSL_CTX>;
typedef map<string, SSL_CTX_ptr> DomainContexts;
...

static DomainContexts contexts;
...

string domain = "example.com"
SSL_CTX_ptr ctx(CreateServerContext(domain), ::SSL_CTX_free);
contexts.insert(std::pair<string, SSL_CTX_ptr>(domain, ctx));
代码产生以下编译器错误:

In file included from /usr/include/c++/4.7/bits/shared_ptr.h:52:0,
                 from /usr/include/c++/4.7/memory:87,
                 from /home/ac-project/include/ac-common.h:42,
                 from ../source/ac-openssl-2.cpp:1:
/usr/include/c++/4.7/bits/shared_ptr_base.h: In instantiation of ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter) [with _Ptr = std::nullptr_t; _Deleter = long int; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’:
/usr/include/c++/4.7/bits/shared_ptr_base.h:798:35:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::nullptr_t, _Deleter) [with _Deleter = long int; _Tp = ssl_ctx_st; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u; std::nullptr_t = std::nullptr_t]’
/usr/include/c++/4.7/bits/shared_ptr.h:147:37:   required from ‘std::shared_ptr<_Tp>::shared_ptr(std::nullptr_t, _Deleter) [with _Deleter = long int; _Tp = ssl_ctx_st; std::nullptr_t = std::nullptr_t]’
../source/ac-openssl-2.cpp:82:38:   required from here
/usr/include/c++/4.7/bits/shared_ptr_base.h:482:8: error: ‘__d’ cannot be used as a function
/usr/include/c++/4.7/bits/shared_ptr_base.h: In instantiation of ‘void std::_Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp>::_M_dispose() [with _Ptr = std::nullptr_t; _Deleter = long int; _Alloc = std::allocator<int>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’:
../source/ac-openssl-2.cpp:549:1:   required from here
/usr/include/c++/4.7/bits/shared_ptr_base.h:350:9: error: ‘((std::_Sp_counted_deleter<std::nullptr_t, long int, std::allocator<int>, (__gnu_cxx::_Lock_policy)2u>*)this)->std::_Sp_counted_deleter<std::nullptr_t, long int, std::allocator<int>, (__gnu_cxx::_Lock_policy)2u>::_M_del.std::_Sp_counted_deleter<std::nullptr_t, long int, std::allocator<int>, (__gnu_cxx::_Lock_policy)2u>::_My_Deleter::_M_del’ cannot be used as a function
我认为这个错误与复制共享\u ptr有关,但我也认为共享\u ptr是可复制的


知道我做错了什么吗?

哪一行是ac tls服务器。cpp:84,哪一行是ac tls服务器。cpp:551?啊,好的。我明白我做错了什么。我假设这是我正在处理的代码,如上图所示。当我重写CreateServerContext时,我在另一个文件的第84行和第551行中删除了一些内容。让我继续投票吧。我的坏朋友。。。这里是第82行:SSL_CTX_ptr ctxNULL,NULL;当SSL_CTX_ptr是唯一的_ptr时,它是有效的。当我移动到映射以缓存上下文时,我将类型更改为共享\u ptr,以便可以复制它。
In file included from /usr/include/c++/4.7/bits/shared_ptr.h:52:0,
                 from /usr/include/c++/4.7/memory:87,
                 from /home/ac-project/include/ac-common.h:42,
                 from ../source/ac-openssl-2.cpp:1:
/usr/include/c++/4.7/bits/shared_ptr_base.h: In instantiation of ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter) [with _Ptr = std::nullptr_t; _Deleter = long int; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’:
/usr/include/c++/4.7/bits/shared_ptr_base.h:798:35:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::nullptr_t, _Deleter) [with _Deleter = long int; _Tp = ssl_ctx_st; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u; std::nullptr_t = std::nullptr_t]’
/usr/include/c++/4.7/bits/shared_ptr.h:147:37:   required from ‘std::shared_ptr<_Tp>::shared_ptr(std::nullptr_t, _Deleter) [with _Deleter = long int; _Tp = ssl_ctx_st; std::nullptr_t = std::nullptr_t]’
../source/ac-openssl-2.cpp:82:38:   required from here
/usr/include/c++/4.7/bits/shared_ptr_base.h:482:8: error: ‘__d’ cannot be used as a function
/usr/include/c++/4.7/bits/shared_ptr_base.h: In instantiation of ‘void std::_Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp>::_M_dispose() [with _Ptr = std::nullptr_t; _Deleter = long int; _Alloc = std::allocator<int>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]’:
../source/ac-openssl-2.cpp:549:1:   required from here
/usr/include/c++/4.7/bits/shared_ptr_base.h:350:9: error: ‘((std::_Sp_counted_deleter<std::nullptr_t, long int, std::allocator<int>, (__gnu_cxx::_Lock_policy)2u>*)this)->std::_Sp_counted_deleter<std::nullptr_t, long int, std::allocator<int>, (__gnu_cxx::_Lock_policy)2u>::_M_del.std::_Sp_counted_deleter<std::nullptr_t, long int, std::allocator<int>, (__gnu_cxx::_Lock_policy)2u>::_My_Deleter::_M_del’ cannot be used as a function