1
fb_t의 부스트 행렬을 사용하려고합니다. 이것은 유한 필드의 요소를 나타내는 relic 객체입니다. 여기에 fb_t이 문서에서 정의하는 방법입니다유물이 포함 된 부스트 행렬
typedef uint64_t dig_t
typedef align dig_t fb_t[FB_DIGS+PADDING(FB_BYTES)/(FB_DIGIT/8)]
을 여기에 내 코드입니다 :
#include <iostream>
#include <boost/numeric/ublas/matrix.hpp>
extern "C" {
#include <relic.h>
}
#include "relic_test.h"
using namespace std;
typedef boost::numeric::ublas::matrix<fb_t> matrix;
int main(void) {
core_init();
fb_param_set_any();
fb_param_print();
matrix mat(2,2);
core_clean();
return 0;
}
나는 다음과 같은 오류가있어 : 나는 무엇을 확신
Compiling: main.cpp
In file included from /usr/include/boost/numeric/ublas/vector.hpp:19:0,
from /usr/include/boost/numeric/ublas/matrix.hpp:16,
from /home/Foo/main.cpp:2:
/usr/include/boost/numeric/ublas/storage.hpp: In instantiation of ‘boost::numeric::ublas::unbounded_array<T, ALLOC>::unbounded_array(boost::numeric::ublas::unbounded_array<T, ALLOC>::size_type, const ALLOC&) [with T = unsigned int [4]; ALLOC = std::allocator<unsigned int [4]>; boost::numeric::ublas::unbounded_array<T, ALLOC>::size_type = unsigned int]’:
/usr/include/boost/numeric/ublas/matrix.hpp:131:92: required from ‘boost::numeric::ublas::matrix<T, L, A>::matrix(boost::numeric::ublas::matrix<T, L, A>::size_type, boost::numeric::ublas::matrix<T, L, A>::size_type) [with T = unsigned int [4]; L = boost::numeric::ublas::basic_row_major<>; A = boost::numeric::ublas::unbounded_array<unsigned int [4], std::allocator<unsigned int [4]> >; boost::numeric::ublas::matrix<T, L, A>::size_type = unsigned int]’
/home/Foo/main.cpp:21:19: required from here
/usr/include/boost/numeric/ublas/storage.hpp:71:23: error: functional cast to array type ‘boost::numeric::ublas::unbounded_array<unsigned int [4], std::allocator<unsigned int [4]> >::value_type {aka unsigned int [4]}’
/usr/include/boost/numeric/ublas/storage.hpp: In instantiation of ‘static void boost::numeric::ublas::unbounded_array<T, ALLOC>::iterator_destroy(T*&) [with T = unsigned int [4]; ALLOC = std::allocator<unsigned int [4]>; boost::numeric::ublas::unbounded_array<T, ALLOC>::iterator = unsigned int (*)[4]]’:
/usr/include/boost/numeric/ublas/storage.hpp:106:25: required from ‘boost::numeric::ublas::unbounded_array<T, ALLOC>::~unbounded_array() [with T = unsigned int [4]; ALLOC = std::allocator<unsigned int [4]>]’
/usr/include/boost/numeric/ublas/matrix.hpp:90:11: required from here
/usr/include/boost/numeric/ublas/storage.hpp:290:13: error: request for member ‘~boost::numeric::ublas::unbounded_array<unsigned int [4], std::allocator<unsigned int [4]> >::value_type’ in ‘* i’, which is of non-class type ‘unsigned int [4]’
을 아니에요 오류 메시지가 표시됩니다. 어떤 생각?
를 사용 :이 해결하기 위해 당신은 클래스에서
fb_t
을 포장 할 수있다. 오류 메시지는'ValueType (value)'과 같은 것을하려고하는 것입니다. 배열이 복사 될 수 없기 때문에'ValueType'이 배열 인 경우 유효하지 않습니다. –@DavidBrown 나는 비슷한 것을 의심했다. 이 문제를 해결하는 방법에 대한 제안이 있습니까? – nullgraph
올바르게 구성하고 복사하는 클래스에서'fb_t'를 래핑 할 수 있습니다. 아니면'std :: array'로 대체 할 수 있습니다. –