나는 std :: arrays를 포함하는 deque를 가지고있다.배열을 포함하는 구조체
struct가 들어있는 deque로 변환하고 싶습니다. 내가 만든 구조체는 다음과 같이이다 :
struct New_Array {
array<array<int,4>,4> tablee;
int h;
} Jim;
그리고 방문이라는 양단 큐가 :
deque<New_Array> visited;
나는 그런 기능이 PrintBoard라는 이름의 배열을 인쇄해야합니다. 내가 PrintBoard(visited.front());
을 쓸 때
void PrintBoard(New_Array tt) {
using namespace std;
for (int iRow = 0; iRow < 4; ++iRow) {
for (int iCol = 0; iCol < 4; ++iCol) {
cout << tt.tablee[iRow][iCol];
cout << " ";//This space helps so the numbers can be visable
//to the user
}
cout << endl;
}
}
는 문제가 무엇입니까 나에게 error C2664: 'PrintBoard cannot convert parameter 1 from 'New_Array' to std:tr1::array<_Ty,Size>'.
을 준다? 테이블을 일차원 적으로 사용하지 않았습니다.
편집 :
#include <deque>
#include <vector>
#include <array>
using namespace std;
struct New_Array {
array<array<int,4>,4> tablee;
int h;
}str_test,Jim;
deque<New_Array> visited;
void dfs()
{
PrintBoard(visited.front());//****the error is in this line****
}
void PrintBoard(New_Array tt) {
using namespace std;
for (int iRow = 0; iRow < 4; ++iRow) {
for (int iCol = 0; iCol < 4; ++iCol) {
cout << tt.tablee[iRow][iCol];
cout << " ";//This space helps so the numbers can be visable
//to the user
}
cout << endl;
}
}
int main()
{
dfs();
char test_char;
cin>> test_char;
return EXIT_SUCCESS;
}
이 코드를 컴파일 할 수있는 단일 코드 블록 (예 : [SSCCE] (http://sscce.org))으로 구성 할 수 있습니까? 위의 코드를 파일에 넣고 main()을 작성하면 g/w를 사용하여 컴파일됩니다. – je4d
샘플에서 오류가 발생한 행은 무엇입니까? – ssube
@ je4d 편집 내용보기 –