Using the find method to find elements in the vector, I found a strange problem.
When I independently verified the find function myself, I found that there was no problem. It’s weird going into this code.
/ home// XXX XXX. CPP: 163:63: error: no matching function for the call to ‘find (STD: : vector< int> ::iterator, std::vector< int> ::ite
rator, __gnu_cxx::__alloc_traits< std::allocator< int> > ::value_type&) ‘
it = find (tQubits. The begin (), tQubits. The end (), AllQubits [I]);
^
In the file included the from/usr/include/c + +/6/bits/locale_facets. H: 48:0,
the from The/usr/include/c + +/6/bits/basic_ios. H: 37,
the from/usr/include/c + +/6/ios: 44,
the from/usr/include/c + +/6/cost: 38,
the from/usr/include/c + +/6/fstream: 38,
the from/home/FDD/Quantum_simulator shor_factoring/core/QCore. H: 11,
the from /home/fdd/Quantum_simulator/shor_factoring/core/QCore.cpp:8:
/usr/include/c++/6/bits/streambuf_iterator.h:369:5: note: candidate: template< class _CharT2> typename __gnu_cxx::__enable_if< std::__is_char< _CharT2> ::__value, st
d::istreambuf_iterator< _CharT> > ::__type std::find(std::istreambuf_iterator< _CharT> , std::istreambuf_iterator< _CharT> , const _CharT2&)
the find (istreambuf_iterator & lt; _CharT> __first,
^ ~ ~ ~
/usr/include/c + +/6/bits/streambuf_iterator. H: 369-5: note: the template argument deduction/substitution failed:
/home// XXX XXX. CPP: 163-63: Note: ‘__gnu_cxx: : __normal_iterator & lt; int*, std::vector< int> > “Is not derived from ‘STD ::istre
ambuf_iterator< _CharT> ‘
it = find (tQubits. The begin (), tQubits. The end (), AllQubits [I]);
^
It took a long time, but I finally found a solution on a foreign website. The find function needs a header file containing the algorithm…
Add a line #include< algorithm> That’s it!
So I have to write a note, hoping to be helpful to future generations!
Read More:
- [debug notes] pointer error when STD:: vector is used in VTK “access conflict when reading location XXX”
- C++: terminate called after throwing an instance of ‘std::length_error‘ (sort function cmp sorting rules problem)
- error C2784: ‘bool std::operator <(const std::_Tre
- When using quartus for function simulation, “testbench” appears_ vector_ input_ The solution of “file option does not exist”
- Vector delete pop of element_ back(),erase(),remove()
- vector length_error
- c++ terminate called after throwing an instance of ‘std::system_error‘ what(): Unknown error -1
- error: ‘vector’ does not name a type
- error: ‘vector‘ was not declared in this scope|
- Map to vector pair map.second sort
- iOS Failed to find matching arch for 64-bit Mach-O input file
- Error: cannot allocate vector of size 88.1 MB
- libxx.so: undefined reference, vector.reserve(n) [How to Solve]
- variable ‘std:ofstream’ has initializer but incomplete type
- Solution of adding judgment error in the iterative process of Java iterator iterator
- Error: failed to find conversion function from unknown to text
- Caused by the “error string in namespace std does not name a type” error
- no matching manifest for linux/arm64/v8 in the manifest list entries
- Error: [VueLoaderPlugin Error] No matching use for vue-loader is found. Make sure the rule matching
- When MATLAB uses audioread, an error is reported: Error using which Must be a string scalar or character vector.