c++ - Boost intrusive list 中有很多编译错误
问题描述
我已经下载了 Boost.Asio lib,然后将其连接到 microsoft visual studio 2017,我使用了这个教程视频。它工作正常,但是当我使用 boost intrusive list 时,它会引发编译错误。
我尝试了很多版本的 boost 库,但几乎所有版本都出现相同的错误。现在我使用 1.71.0 版本的 boost 库。
这是非常简单的代码:
#include "pch.h"
#include "boost/intrusive/list.hpp"
int main() {
boost::intrusive::list<int> h;
}
我只是想确保它可以正常工作,但会引发很多错误。
这是错误列表:
1>ConsoleApplication1.cpp
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(55): error C2825:
'T': must be a class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\get_value_traits.hpp
(145): note: see reference to class template instantiation
'boost::intrusive::default_list_hook_applier::apply<T>' being compiled
1> with
1> [
1> T=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\get_value_traits.hpp
(204): note: see reference to class template instantiation
'boost::intrusive::detail::supposed_value_traits<SupposedValueTraits,T,
true>' being compiled
1> with
1> [
1>
SupposedValueTraits=boost::intrusive::list_defaults::proto_value_traits,
1> T=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1428): note: see
reference to class template instantiation
'boost::intrusive::detail::get_value_traits<T,boost::intrusive::
list_defaults::proto_value_traits>' being compiled
1> with
1> [
1> T=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1455):
note: see reference to class template instantiation
'boost::intrusive::make_list<T>' being compiled
1> with
1> [
1> T=int
1> ]
1>d:\libcds-master\libcds-
master\projects\win\consoleapplication1\consoleapplication1.cpp(7): note:
see reference to class template instantiation
'boost::intrusive::list<int>' being compiled
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(55): error C2510:
'T': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(55): error C3646:
'type': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(55): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\get_value_traits.
hpp(145): error C2039: 'type': is not a member of
'boost::intrusive::default_list_hook_applier::apply<T>'
1> with
1> [
1> T=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\get_value_traits
.hpp(145): note: see declaration of
'boost::intrusive::default_list_hook_applier::apply<T>'
1> with
1> [
1> T=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\get_value_traits
.hpp(145): error C3646: 'type': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\get_value_traits
.hpp(145): error C4430: missing type specifier - int assumed. Note: C++
does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(91): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::value_traits': must be a class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1456): note: see
reference to class template instantiation
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>'
being compiled
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(91): error C2510:
'value_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(91): error C3646:
'pointer': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(91): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(92): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::value_traits': must be a class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(92): error C2510:
'value_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(92): error C3646:
'const_pointer': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(92): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(102): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::value_traits': must be a class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(102): error C2510:
'value_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(102): error C3646:
'node_traits': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(102): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(103): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::node_traits': must be a class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(103): error C2510:
'node_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(103): error C3646:
'node': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(103): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(104): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults::
size_type,true,boost::intrusive::list_defaults::header_holder_type>
::node_traits': must be a class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(104): error C2510:
'node_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(104): error C3646:
'node_ptr': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(104): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(105): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::node_traits': must be a class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(105): error C2510:
'node_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(105): error C3646:
'const_node_ptr': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(105): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
default_header_holder.hpp(63): error C2825: 'ValueTraits': must be a class
or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(108): note: see
reference to class template instantiation
'boost::intrusive::detail::get_header_holder_type<int,HeaderHolder>' being
compiled
1> with
1> [
1>
HeaderHolder=boost::intrusive::list_defaults::header_holder_type
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
default_header_holder.hpp(63): error C2510: 'ValueTraits': left
of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
default_header_holder.hpp(63): error C2146: syntax error: missing '>'
before identifier 'node_traits'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
default_header_holder.hpp(63): error C2062: type 'unknown-type' unexpected
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
default_header_holder.hpp(63): error C2238: unexpected token(s) preceding
';'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(108): error C2039:
'type': is not a member of
'boost::intrusive::detail::get_header_holder_type<int,HeaderHolder>'
1> with
1> [
1>
HeaderHolder=boost::intrusive::list_defaults::header_holder_type
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(107): note: see
declaration of
'boost::intrusive::detail::get_header_holder_type<int,HeaderHolder>'
1> with
1> [
1>
HeaderHolder=boost::intrusive::list_defaults::header_holder_type
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(108): error C3646:
'header_holder_type': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(108): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(54): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(111): note: see
reference to class template instantiation
'boost::intrusive::detail::is_stateful_value_traits<int>' being compiled
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(54): error C2510: 'ValueTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(54): error C3646: 'node_ptr': unknown
override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(54): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(55): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(55): error C2510: 'ValueTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(55): error C3646: 'pointer': unknown override
specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(55): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(56): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(56): error C2510: 'ValueTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(56): error C3646: 'value_type': unknown
override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(56): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(57): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(57): error C2510: 'ValueTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(57): error C3646: 'const_node_ptr': unknown
override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(57): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(58): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(58): error C2510: 'ValueTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(58): error C3646: 'const_pointer': unknown
override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(58): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(64): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(64): error C2653: 'ValueTraits': is not a
class or namespace name
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(64): error C2269: cannot create a pointer or
reference to a qualified function type (requires pointer-to-member)
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(67): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(67): error C2653: 'ValueTraits': is not a
class or namespace name
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(67): error C2269: cannot create a pointer or
reference to a qualified function type (requires pointer-to-member)
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(70): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(70): error C2653: 'ValueTraits': is not a
class or namespace name
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(70): error C2269: cannot create a pointer or
reference to a qualified function type (requires pointer-to-member)
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(73): error C2825: 'ValueTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(73): error C2653: 'ValueTraits': is not a
class or namespace name
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\
is_stateful_value_traits.hpp(73): error C2269: cannot create a pointer or
reference to a qualified function type (requires pointer-to-member)
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(113): error C3203:
'header_holder_type': unspecialized class template can't be used as a
template argument for template parameter 'T', expected a real type
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(123): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::
list_defaults::size_type,true,boost::intrusive::list_defaults
::header_holder_type>::value_traits': must be a class or namespace when
followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(123): error C2510:
'value_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(123): error C2993:
'boost::intrusive::link_mode': illegal type for non-type template
parameter 'link_mode'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(123): error C2903:
'is_safe_autounlink': symbol is neither a class template nor a function
template
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(123): error C2065:
'value': undeclared identifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(123): error C2131:
expression did not evaluate to a constant
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(123): note: a non-
constant (sub-)expression was encountered
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(126): error C2825:
'boost::intrusive::list_impl<int,boost::intrusive::
list_defaults::size_type,true,boost::intrusive::
list_defaults::header_holder_type>::value_traits': must be a class or
namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(126): error C2510:
'value_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(126): error C2955:
'boost::intrusive::link_mode': use of class template requires template
argument list
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\options.hpp(180): note: see
declaration of 'boost::intrusive::link_mode'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(142): error C2955:
'boost::intrusive::value_traits': use of class template requires template
argument list
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\options.hpp(110): note: see
declaration of 'boost::intrusive::value_traits'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(149): note: see
reference to class template instantiation
'boost::intrusive::list_impl<int,boost::intrusive
::list_defaults::size_type,true,boost::intrusive::list_defaults
::header_holder_type>::data_t' being compiled
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(40):
error C2825: 'ValueTraits': must be a class or namespace when followed by
'::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(164): note: see
reference to class template instantiation
'boost::intrusive::value_traits_pointers<ValueTraits>' being compiled
1> with
1> [
1> ValueTraits=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(36):
error C2510: 'ValueTraits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(40):
error C2146: syntax error: missing '>' before identifier 'node_ptr'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(40):
error C2062: type 'unknown-type' unexpected
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(40):
error C2903: 'rebind_pointer': symbol is neither a class template nor a
function template
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(36):
error C2039: 'type': is not a member of '`global namespace''
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(40):
error C2238: unexpected token(s) preceding ';'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(42):
error C2065: 'value_traits_ptr': undeclared identifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(42):
error C2923: 'boost::intrusive::pointer_traits': 'value_traits_ptr' is not
a valid template type argument for parameter 'Ptr'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(43):
error C2903: 'pointer_traits': symbol is neither a class template nor a
function template
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(43):
error C2903: 'rebind_pointer': symbol is neither a class template nor a
function template
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(43):
error C2039: 'type': is not a member of 'boost::intrusive'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(50): note: see
declaration of 'boost::intrusive'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(43):
error C2062: type 'unknown-type' unexpected
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\detail\iiterator.hpp(43):
error C2238: unexpected token(s) preceding ';'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(164): error C2039:
'const_value_traits_ptr': is not a member of
'boost::intrusive::value_traits_pointers<ValueTraits>'
1> with
1> [
1> ValueTraits=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(163): note: see
declaration of 'boost::intrusive::value_traits_pointers<ValueTraits>'
1> with
1> [
1> ValueTraits=int
1> ]
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(164): error C3646:
'const_value_traits_ptr': unknown override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(164): error C4430:
missing type specifier - int assumed. Note: C++ does not support default-
int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1289): error
C2556: 'boost::intrusive::list_iterator<int,true>
boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::s_iterator_to(boost::move_detail::unvoid_ref<void> &)': overloaded
function differs only by return type from
'boost::intrusive::list_iterator<int,false>
boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::s_iterator_to(boost::move_detail::unvoid_ref<void> &)'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1270): note: see
declaration of
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::s_iterator_to'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1288): error
C2371:
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::s_iterator_to': redefinition; different basic types
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1270): note: see
declaration of
'boost::intrusive::list_impl<int,boost::intrusive::list_defaults
::size_type,true,boost::intrusive::list_defaults::header_holder_type>
::s_iterator_to'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1292): error
C2062: type 'void' unexpected
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(59): error C2825: 'NodeTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1292): note: see
reference to class template instantiation
'boost::intrusive::circular_list_algorithms<int>' being compiled
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(59): error C2510: 'NodeTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(59): error C3646: 'node': unknown override
specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(59): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(60): error C2825: 'NodeTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(60): error C2510: 'NodeTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(60): error C3646: 'node_ptr': unknown
override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(60): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(61): error C2825: 'NodeTraits': must be a
class or namespace when followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(61): error C2510: 'NodeTraits': left of '::'
must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(61): error C3646: 'const_node_ptr': unknown
override specifier
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\
circular_list_algorithms.hpp(61): error C4430: missing type specifier -
int assumed. Note: C++ does not support default-int
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1292): error
C2825:
'boost::intrusive::list_impl<int,boost::intrusive
::list_defaults::size_type,true,boost::intrusive::list_defaults
::header_holder_type>::value_traits': must be a class or namespace when
followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1292):
error C2510: 'value_traits': left of '::' must be a class/struct/union
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1292): error
C2238: unexpected token(s) preceding ';'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1293): error
C2059: syntax error: 'return'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1293): error
C2825:
'boost::intrusive::list_impl<int,boost::intrusive::
list_defaults::size_type,true,boost::intrusive::list_defaults
::header_holder_type>::value_traits': must be a class or namespace when
followed by '::'
1>d:\boost_1_71_0\boost_1_71_0\boost\intrusive\list.hpp(1293): fatal error
C1003: error count exceeds 100; stopping compilation
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
解决方案
boost::intrusive::list<T>
使用您T
必须T
提供的成员。您可以通过继承boost::intrusive::list_base_hook<>
或创建member_hook_
type的成员来做到这一点boost::intrusive::list_member_hook<>
。这也意味着,您不能将原始数据类型用作T
.
以下是来自官方网站的示例:
#include <boost/intrusive/list.hpp>
#include <vector>
using namespace boost::intrusive;
class MyClass : public list_base_hook<> //This is a derivation hook
{
int int_;
public:
//This is a member hook
list_member_hook<> member_hook_;
MyClass(int i)
: int_(i)
{}
};
//Define a list that will store MyClass using the public base hook
using BaseList = list<MyClass>;
//Define a list that will store MyClass using the public member hook
using MemberList = list<MyClass, list_member_hook<>, &MyClass::member_hook_>>;
您可以在成员挂钩和派生挂钩之间进行选择。
推荐阅读
- excel - 如果条件匹配,则计算日期之间的产品数量
- ios - Firebase 存储的下载 URL 不起作用
- python - 奇怪的电报机器人探测
- architecture - (DDD) 检索存储在多个数据库中的实体
- c# - 两条 Xamarin.Forms.Shapes 线相互重叠,顶线投射“阴影”(仅在 iOS 上)
- xml - 使用 sed 更新 xml 中的属性值
- python - 通过 Artist 更新 matplotlib 中的文本
- java - 如何在 React Native 中使用 java 类?
- plotly - 从反应中访问 Plotly 直方图间隔
- python - 列出 Python 文件的所有依赖项