[转] std::_Copy_impl

本文探讨了在VS2012中模拟实现C++ Primer中的vector容器时遇到的编译问题,并提供了多种解决方案,包括禁用安全检查、使用替代函数等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在C++ PRIMER中模拟实现vector容器所给的代码中,如果你用的是vs 2012的话,那么你会发现根本就不能通过编译,这时应该怎么办呢?

有问题代码为:uninitialized_copy(elements , first_free , newelements) ;
上述代码的目的是把elements到first_free之间的内存中的数据复制到以newelements开始的内存中

首先把这段代码放到vs 2010进行编译、运行你会发现只是弹出了如下的信息,但是能正确运行。

warning C4996: 'std::_Uninitialized_copy0': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

在vs 2012中进行编译会弹出如下信息:

error C4996: 'std::_Uninitialized_copy0': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'


有上述代码的功能我想可以想到用如下的代码替代它:copy(elements , first_free , newelements) ; 

此时你会发现在vs 2012中的编译信息如下:

error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

而在vs 2010中却仍可以正确编译并运行,所显示的编译信息如下:

warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

从编译的信息来看vs 2012有点矛盾的地方,也即error C4996 ... To disable this warning前面说是error后面却成了warning,逻辑上不太相符,当然这不排除是汉化引起的。

在vs 2012中不能像C++ PRIMER中所描述的那样使用这两个函数的原因是在vs 2012中提升了安全机制,在这里如果我们还是想直接使用这两个函数那么,我们可以在使用前添加如下的宏定义:

#ifndef _SECURE_SCL
#define _SECURE_SCL 0
#else
#undef _SECURE_SCL
#define _SECURE_SCL 0
#endif


#ifndef _ITERATOR_DEBUG_LEVEL
#define _ITERATOR_DEBUG_LEVEL 0
#else
#undef _ITERATOR_DEBUG_LEVEL
#define _ITERATOR_DEBUG_LEVEL 0
#endif

或者加入预处理器:(项目属性----C/C++----预处理----预处理器定义):
_SCL_SECURE_NO_WARNINGS

当然我们也可以不用这两个函数,而使用其它的函数来完成相同的功能,如以下几个函数:

1、用头文件algorithm中提供的模板函数copy(FwdIt first, FwdIt last, const T& x)来提供:
添加上述的宏定义,然后用
copy(elements , first_free , newelements) ; 

2、用头文件memory中allocator类提供的操作constuct(p , t)来提供:
for(ptrdiff_t i=0 ; i
   alloc.construct(newelements+i , elements[i]) ;

3、用头文件memory中提供的模板函数uninitialized_fill(FwdIt first, FwdIt last, const T& x)来提供:
for(ptrdiff_t i=0 ; i
   uninitialized_fill(newelements+i , newelements+i+1 , elements[i]) ;

4、用头文件algorithm中提供的模板函数fill(FwdIt first, FwdIt last, const T& x)来提供:
for(ptrdiff_t i=0 ; i
   fill(newelements+i , newelements+i+1 , elements[i]) ;

5、用头文件memory.h中提供的函数memcpy( void *dest, const void *src, size_t count )或memmove( void *dest, const void *src, size_t count )来提供:(T是所写的模板类的模板参数)
memcpy(newelements , elements , size*sizeof(T)) ;
memmove(newelements , elements , size*sizeof(T)) ;



下面对上面用到的宏进行简单的介绍:

_SECURE_SCL (SCL) macro defines whether Checked Iterators(Checked iterators ensure that the bounds of your container are not overwritten) are enabled.
 If defined as 1, unsafe iterator use causes a runtime error and the program is terminated.
 If defined as 0, checked iterators are disabled.
 In debug mode, the default value for _SECURE_SCL is 1, meaning checked iterators are enabled. 
 In release mode, the default value for _SECURE_SCL is 0.


_HAS_ITERATOR_DEBUGGING (HID) macro defines whether the iterator debugging feature is enabled in a debug build.
 By default, iterator debugging is enabled. 


The following section describes the possible values of the SCL and HID macros :
SCL=0    Disables checked iterators.
SCL=1    Enables checked iterators.
HID=0    Disables iterator debugging in debug builds.
HID=1    Enables iterator debugging in debug builds. HID cannot be enabled in release builds.


The _ITERATOR_DEBUG_LEVEL (IDL) macro supersedes and combines the functionality of the _SECURE_SCL (SCL) and _HAS_ITERATOR_DEBUGGING (HID) macros.


The following table describes how the IDL macro values supersede the SCL and HID macro values :

Compilation mode

New macro

Old macros

Description

Debug

 

 

 

 

IDL=0

SCL=0, HID=0

Disables checked iterators and disables iterator debugging.

 

IDL=1

SCL=1, HID=0

Enables checked iterators and disables iterator debugging.

 

IDL=2 (Default)

SCL=(does not apply), HID=1

By default, enables iterator debugging; checked iterators are not relevant.

Release

 

 

 

 

IDL=0 (Default)

SCL=0

By default, disables checked iterators.

 

IDL=1

SCL=1

Enables checked iterators; iterator debugging is not relevant.

/data/k50048780/cpp_mutator/mutators/BitStream.cpp: In member function ‘BitStream BitStream::slice(size_t, size_t) const’: /data/k50048780/cpp_mutator/mutators/BitStream.cpp:154:46: error: passing ‘const BitStream’ as ‘this’ argument discards qualifiers [-fpermissive] 154 | copy_bits(*this, start_bit, 0, bit_length); | ^ In file included from /data/k50048780/cpp_mutator/mutators/BitStream.cpp:5: /data/k50048780/cpp_mutator/mutators/BitStream.h:62:10: note: in call to ‘void BitStream::copy_bits(const BitStream&, size_t, size_t, size_t)’ 62 | void copy_bits(const BitStream& src, size_t src_start, size_t dest_start, size_t bit_count); | ^~~~~~~~~ CMakeFiles/mutator.dir/build.make:446: recipe for target 'CMakeFiles/mutator.dir/mutators/BitStream.cpp.o' failed make[3]: *** [CMakeFiles/mutator.dir/mutators/BitStream.cpp.o] Error 1 make[3]: *** Waiting for unfinished jobs.... /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp: In constructor ‘StringLengthEdgeCase::StringLengthEdgeCase(std::shared_ptr<StringBase>, std::mt19937)’: /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:10:37: error: no matching function for call to ‘IntegerEdgeCases::IntegerEdgeCases(std::shared_ptr<StringBase>&, std::mt19937&)’ 10 | : IntegerEdgeCases(obj, rand) { | ^ In file included from /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.h:10, from /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:5: /data/k50048780/cpp_mutator/mutators/string/../utils.h:146:5: note: candidate: ‘IntegerEdgeCases::IntegerEdgeCases(std::shared_ptr<NumberBase>, std::mt19937&)’ 146 | IntegerEdgeCases(std::shared_ptr<NumberBase> obj, std::mt19937 &rand); | ^~~~~~~~~~~~~~~~ /data/k50048780/cpp_mutator/mutators/string/../utils.h:146:50: note: no known conversion for argument 1 from ‘shared_ptr<StringBase>’ to ‘shared_ptr<NumberBase>’ 146 | IntegerEdgeCases(std::shared_ptr<NumberBase> obj, std::mt19937 &rand); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /data/k50048780/cpp_mutator/mutators/string/../utils.h:144:7: note: candidate: ‘IntegerEdgeCases::IntegerEdgeCases(const IntegerEdgeCases&)’ 144 | class IntegerEdgeCases : public Mutator { | ^~~~~~~~~~~~~~~~ /data/k50048780/cpp_mutator/mutators/string/../utils.h:144:7: note: candidate expects 1 argument, 2 provided /data/k50048780/cpp_mutator/mutators/string/../utils.h:144:7: note: candidate: ‘IntegerEdgeCases::IntegerEdgeCases(IntegerEdgeCases&&)’ /data/k50048780/cpp_mutator/mutators/string/../utils.h:144:7: note: candidate expects 1 argument, 2 provided /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp: In member function ‘virtual std::pair<long int, long int> StringLengthEdgeCase::get_limits(std::shared_ptr<StringBase>)’: /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:24:25: error: request for member ‘has_value’ in ‘((std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>*)(& obj))->std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>::operator->()->StringBase::<anonymous>.TypeBase<StringBase>::max_length’, which is of non-class type ‘int64_t’ {aka ‘long int’} 24 | if (obj->max_length.has_value()) { | ^~~~~~~~~ /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:25:47: error: request for member ‘value’ in ‘((std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>*)(& obj))->std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>::operator->()->StringBase::<anonymous>.TypeBase<StringBase>::max_length’, which is of non-class type ‘int64_t’ {aka ‘long int’} 25 | max_ = std::min(max_, obj->max_length.value()); | ^~~~~ /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:29:25: error: request for member ‘has_value’ in ‘((std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>*)(& obj))->std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>::operator->()->StringBase::<anonymous>.TypeBase<StringBase>::min_length’, which is of non-class type ‘int64_t’ {aka ‘long int’} 29 | if (obj->min_length.has_value()) { | ^~~~~~~~~ /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:30:47: error: request for member ‘value’ in ‘((std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>*)(& obj))->std::__shared_ptr_access<StringBase, __gnu_cxx::_S_atomic, false, false>::operator->()->StringBase::<anonymous>.TypeBase<StringBase>::min_length’, which is of non-class type ‘int64_t’ {aka ‘long int’} 30 | min_ = std::max(min_, obj->min_length.value()); | ^~~~~ /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp: At global scope: /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:42:6: error: no declaration matches ‘void StringLengthEdgeCase::perform_mutation(std::shared_ptr<StringBase>, int64_t)’ 42 | void StringLengthEdgeCase::perform_mutation(std::shared_ptr<StringBase> obj, int64_t value) { | ^~~~~~~~~~~~~~~~~~~~ In file included from /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.cpp:5: /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.h:16:10: note: candidate is: ‘void StringLengthEdgeCase::perform_mutation(std::shared_ptr<String>, size_t)’ 16 | void perform_mutation(std::shared_ptr<String> obj, size_t index); | ^~~~~~~~~~~~~~~~ /data/k50048780/cpp_mutator/mutators/string/StringLengthEdgeCase.h:13:7: note: ‘class StringLengthEdgeCase’ defined here 13 | class StringLengthEdgeCase : public IntegerEdgeCases { | ^~~~~~~~~~~~~~~~~~~~ In file included from /data/k50048780/cpp_mutator/mutators/MutatorFactory.cpp:8: /data/k50048780/cpp_mutator/mutators/number/NumberVariance.h:13:32: error: invalid covariant return type for ‘virtual std::pair<long unsigned int, long unsigned int> NumberVariance::get_limits(std::shared_ptr<NumberBase>)’ 13 | std::pair<size_t ,size_t > get_limits(std::shared_ptr<NumberBase> obj); | ^~~~~~~~~~ In file included from /data/k50048780/cpp_mutator/mutators/string/../../utils/sample_util.h:12, from /data/k50048780/cpp_mutator/mutators/string/StringCaseLower.h:8, from /data/k50048780/cpp_mutator/mutators/MutatorFactory.cpp:6: /data/k50048780/cpp_mutator/mutators/string/../../utils/../mutators/utils.h:70:51: note: overridden function is ‘virtual std::pair<long int, long int> IntegerVariance::get_limits(std::shared_ptr<NumberBase>)’ 70 | virtual std::pair<std::int64_t, std::int64_t> get_limits(std::shared_ptr<NumberBase> obj); | ^~~~~~~~~~
最新发布
06-28
udo make -j8 Scanning dependencies of target opencv_highgui_plugins Scanning dependencies of target ittnotify Scanning dependencies of target quirc Scanning dependencies of target libprotobuf Scanning dependencies of target ade Scanning dependencies of target opencv_videoio_plugins Scanning dependencies of target gen_opencv_python_source [ 0%] Built target opencv_videoio_plugins [ 0%] Building C object 3rdparty/ittnotify/CMakeFiles/ittnotify.dir/src/ittnotify/ittnotify_static.c.o [ 0%] Built target opencv_highgui_plugins [ 0%] Building C object 3rdparty/quirc/CMakeFiles/quirc.dir/src/decode.c.o [ 0%] Building C object 3rdparty/quirc/CMakeFiles/quirc.dir/src/quirc.c.o [ 0%] Generate files for Python bindings and documentation [ 0%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/alloc.cpp.o [ 0%] Building C object 3rdparty/quirc/CMakeFiles/quirc.dir/src/version_db.c.o [ 0%] Building C object 3rdparty/ittnotify/CMakeFiles/ittnotify.dir/src/ittnotify/jitprofiling.c.o [ 0%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/assert.cpp.o [ 0%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/any_lite.cc.o [ 0%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.o [ 0%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arenastring.cc.o [ 0%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/check_cycles.cpp.o [ 0%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/edge.cpp.o [ 0%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/execution_engine.cpp.o [ 0%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/extension_set.cc.o Note: Class Feature2D has more than 1 base class (not supported by Python C extensions) Bases: cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm Only the first base class will be used [ 0%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/generated_message_util.cc.o [ 1%] Linking C static library ../lib/libittnotify.a [ 1%] Built target ittnotify [ 1%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/graph.cpp.o [ 1%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/implicit_weak_message.cc.o Note: Class detail_GraphCutSeamFinder has more than 1 base class (not supported by Python C extensions) Bases: cv::detail::GraphCutSeamFinderBase, cv::detail::SeamFinder Only the first base class will be used [ 1%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_accessor.cpp.o [ 2%] Linking C static library ../lib/libquirc.a [ 2%] Built target quirc [ 2%] Processing OpenCL kernels (core) Scanning dependencies of target opencv_core [ 2%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/coded_stream.cc.o [ 2%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_descriptor.cpp.o [ 2%] Built target gen_opencv_python_source [ 2%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/io_win32.cc.o [ 2%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/strtod.cc.o [ 2%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_descriptor_ref.cpp.o [ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.o [ 2%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/memory_descriptor_view.cpp.o [ 2%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/metadata.cpp.o [ 2%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/zero_copy_stream.cc.o [ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/alloc.cpp.o [ 2%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/metatypes.cpp.o In file included from /home/z/下载/opencv-4.5.5/modules/core/include/opencv2/core/utility.hpp:56, from /home/z/下载/opencv-4.5.5/modules/core/src/precomp.hpp:53, from /home/z/下载/opencv-4.5.5/modules/core/src/algorithm.cpp:43: /home/z/下载/opencv-4.5.5/modules/core/include/opencv2/core.hpp: In function ‘cv::String& cv::operator<<(cv::String&, const cv::Mat&)’: /home/z/下载/opencv-4.5.5/modules/core/include/opencv2/core.hpp:3102:47: internal compiler error: 段错误 3102 | return out << Formatter::get()->format(mtx); | ^ [ 2%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/zero_copy_stream_impl.cc.o [ 3%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/node.cpp.o 0x7f2e0e35c08f ??? /build/glibc-FcRMwW/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x7f2e0e33d082 __libc_start_main ../csu/libc-start.c:308 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions. make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:90:modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.o] 错误 1 make[2]: *** 正在等待未完成的任务.... [ 3%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp.o [ 3%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/search.cpp.o [ 4%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/zero_copy_stream_impl_lite.cc.o In file included from /usr/include/c++/9/istream:991, from /usr/include/c++/9/iostream:40, from /home/z/下载/opencv-4.5.5/3rdparty/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc:44: /usr/include/c++/9/bits/istream.tcc: In member function ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize, std::basic_istream<_CharT, _Traits>::char_type)’: /usr/include/c++/9/bits/istream.tcc:326:66: internal compiler error: 段错误 326 | const int_type __idelim = traits_type::to_int_type(__delim); | ^ 0x7f0aca24708f ??? /build/glibc-FcRMwW/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x7f0aca228082 __libc_start_main ../csu/libc-start.c:308 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions. make[2]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build.make:193:3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/zero_copy_stream_impl.cc.o] 错误 1 make[2]: *** 正在等待未完成的任务.... [ 4%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/subgraphs.cpp.o [ 4%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/topological_sort.cpp.o during IPA pass: cp /home/z/下载/opencv-4.5.5/3rdparty/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc: In member function ‘virtual void google::protobuf::io::ArrayInputStream::BackUp(int)’: /home/z/下载/opencv-4.5.5/3rdparty/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc:467:1: internal compiler error: 段错误 467 | } // namespace google | ^ 0x7fe12677e08f ??? /build/glibc-FcRMwW/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x7fe12675f082 __libc_start_main ../csu/libc-start.c:308 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions. make[2]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build.make:206:3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/io/zero_copy_stream_impl_lite.cc.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:1625:3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all] 错误 2 make[1]: *** 正在等待未完成的任务.... In file included from /usr/include/c++/9/functional:54, from /home/z/下载/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/metatypes/metatypes.hpp:12, from /home/z/下载/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/include/ade/passes/communications.hpp:14, from /home/z/下载/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp:7: /usr/include/c++/9/tuple: In instantiation of ‘constexpr _Head& std::__get_helper(std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int __i = 0; _Head = ade::MemoryDescriptorView* const&; _Tail = {}]’: /usr/include/c++/9/tuple:1321:36: required from ‘constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&) [with long unsigned int __i = 0; _Elements = {ade::MemoryDescriptorView* const&}; std::__tuple_element_t<__i, std::tuple<_Elements ...> > = ade::MemoryDescriptorView* const&]’ /usr/include/c++/9/tuple:1673:55: required from ‘std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {ade::MemoryDescriptorView* const&}; long unsigned int ..._Indexes1 = {0}; _Args2 = {}; long unsigned int ..._Indexes2 = {}; _T1 = ade::MemoryDescriptorView* const; _T2 = {anonymous}::CacheEntry]’ /usr/include/c++/9/tuple:1663:63: required from ‘std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {ade::MemoryDescriptorView* const&}; _Args2 = {}; _T1 = ade::MemoryDescriptorView* const; _T2 = {anonymous}::CacheEntry]’ /usr/include/c++/9/ext/new_allocator.h:146:4: required from ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>; _Args = {const std::piecewise_construct_t&, std::tuple<ade::MemoryDescriptorView* const&>, std::tuple<>}; _Tp = std::__detail::_Hash_node<std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>, false>]’ /usr/include/c++/9/bits/alloc_traits.h:483:4: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>; _Args = {const std::piecewise_construct_t&, std::tuple<ade::MemoryDescriptorView* const&>, std::tuple<>}; _Tp = std::__detail::_Hash_node<std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>, false>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::__detail::_Hash_node<std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>, false> >]’ /usr/include/c++/9/bits/hashtable_policy.h:2086:36: required from ‘std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type* std::__detail::_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<ade::MemoryDescriptorView* const&>, std::tuple<>}; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>, false> >; std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>, false>]’ /usr/include/c++/9/bits/hashtable_policy.h:701:8: required from ‘std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type& std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::operator[](const key_type&) [with _Key = ade::MemoryDescriptorView*; _Pair = std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry>; _Alloc = std::allocator<std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry> >; _Equal = std::equal_to<ade::MemoryDescriptorView*>; _H1 = std::hash<ade::MemoryDescriptorView*>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type = {anonymous}::CacheEntry; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::key_type = ade::MemoryDescriptorView*]’ /usr/include/c++/9/bits/unordered_map.h:986:20: required from ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = ade::MemoryDescriptorView*; _Tp = {anonymous}::CacheEntry; _Hash = std::hash<ade::MemoryDescriptorView*>; _Pred = std::equal_to<ade::MemoryDescriptorView*>; _Alloc = std::allocator<std::pair<ade::MemoryDescriptorView* const, {anonymous}::CacheEntry> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = {anonymous}::CacheEntry; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = ade::MemoryDescriptorView*]’ /home/z/下载/opencv-4.5.5/build/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp:91:22: required from here /usr/include/c++/9/tuple:1310:56: in ‘constexpr’ expansion of ‘std::_Tuple_impl<0, ade::MemoryDescriptorView* const&>::_M_head(__t)’ /usr/include/c++/9/tuple:1310:60: internal compiler error: 段错误 1310 | { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); } | ^ 0x7f7630e1a08f ??? /build/glibc-FcRMwW/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x7f7630dfb082 __libc_start_main ../csu/libc-start.c:308 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions. make[2]: *** [CMakeFiles/ade.dir/build.make:232:CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp.o] 错误 1 make[2]: *** 正在等待未完成的任务.... make[1]: *** [CMakeFiles/Makefile2:1801:modules/core/CMakeFiles/opencv_core.dir/all] 错误 2 make[1]: *** [CMakeFiles/Makefile2:1465:CMakeFiles/ade.dir/all] 错误 2 make: *** [Makefile:163:all] 错误 2
06-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值