swig 和 python 的向量<向量 >参数

2024-01-15

我试图弄清楚如何使用 SWIG 来包装一个将 2d 向量返回给 python 的 C++ 函数。我有文件functions.h

#include <vector>

std::vector< std::vector<double> >  array_mean(std::vector< std::vector<double> > array)
{

  std::vector< std::vector<double> > mean_array( rows, std::vector<double>(cols));
....

  return mean_array;

}

在接口文件functions.in中我有

%module functions
%{
#include "functions.h"
%}
%include "std_vector.i"
namespace std {
  %template(VecVecdouble) vector< vector<double> >;
}

%include "functions.h"

然后我执行

swig -c++ -python 函数.i

g++ -O2 -fPIC -cfunctions_wrap.cxx -I/usr/include/python2.4 -I/usr/lib/python2.4

编译器会抛出一堆错误。

functions_wrap.cxx: In function 'bool swig::check(PyObject*) [with Type = double]':

functions_wrap.cxx:3763:   instantiated from 'bool    swig::PySequence_Cont<T>::check(bool) const [with T = double]'
functions_wrap.cxx:3820:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<double, std::allocator<double> >, T = double]'

知道有什么问题吗?谢谢。

编辑以包含完整的编译器输出

functions_wrap.cxx:3878:   instantiated from 'static int 

swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = double]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3152:   instantiated from 'static bool swig::traits_check<Type, swig::pointer_category>::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3159:   instantiated from 'bool swig::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3763:   instantiated from 'bool swig::PySequence_Cont<T>::check(bool) const [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3820:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3878:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >]'
functions_wrap.cxx:4946:   instantiated from here
functions_wrap.cxx:3159: error: no type named 'category' in 'struct swig::traits<double>'
functions_wrap.cxx: In function 'const char* swig::type_name() [with Type = double]':
functions_wrap.cxx:2946:   instantiated from 'static swig_type_info* swig::traits_info<Type>::type_info() [with Type = double]'
functions_wrap.cxx:2953:   instantiated from 'swig_type_info* swig::type_info() [with Type = double]'
functions_wrap.cxx:2987:   instantiated from 'static PyObject* swig::traits_from_ptr<Type>::from(Type*, int) [with Type = double]'
functions_wrap.cxx:2993:   instantiated from 'static PyObject* swig::traits_from<Type>::from(const Type&) [with Type = double]'
functions_wrap.cxx:3005:   instantiated from 'PyObject* swig::from(const Type&) [with Type = double]'
functions_wrap.cxx:3862:   instantiated from 'static PyObject* swig::traits_from_stdseq<Seq, T>::from(const Seq&) [with Seq = std::vector<double, std::allocator<double> >, T = double]'
functions_wrap.cxx:3885:   instantiated from 'static PyObject* swig::traits_from<std::vector<T, std::allocator<_CharT> > >::from(const std::vector<T, std::allocator<_CharT> >&) [with T = double]'
functions_wrap.cxx:3005:   instantiated from 'PyObject* swig::from(const Type&) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3862:   instantiated from 'static PyObject* swig::traits_from_stdseq<Seq, T>::from(const Seq&) [with Seq = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3885:   instantiated from 'static PyObject* swig::traits_from<std::vector<T, std::allocator<_CharT> > >::from(const std::vector<T, std::allocator<_CharT> >&) [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3005:   instantiated from 'PyObject* swig::from(const Type&) [with Type = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >]'
functions_wrap.cxx:6430:   instantiated from here
functions_wrap.cxx:2936: error: 'type_name' is not a member of 'swig::traits<double>'
functions_wrap.cxx: In function 'Type swig::as(PyObject*, bool) [with Type = double]':
functions_wrap.cxx:3563:   instantiated from 'swig::PySequence_Ref<T>::operator T() const [with T = double]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:285:   instantiated from 'static _OI std::__copy<_BoolType, std::random_access_iterator_tag>::copy(_II, _II, _OI) [with _II = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OI = double*, bool _BoolType = false]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:317:   instantiated from '_OI std::__copy_aux(_II, _II, _OI) [with _II = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OI = double*]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:326:   instantiated from 'static _OI std::__copy_normal<<anonymous>, <anonymous> >::copy_n(_II, _II, _OI) [with _II = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OI = double*, bool <anonymous> = false, bool <anonymous> = false]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:387:   instantiated from '_OutputIterator std::copy(_InputIterator, _InputIterator, _OutputIterator) [with _InputIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OutputIterator = double*]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:230:   instantiated from 'void std::vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _Tp = double, _Alloc = std::allocator<double>]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:853:   instantiated from 'void std::vector<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator, _InputIterator, __false_type) [with _InputIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _Tp = double, _Alloc = std::allocator<double>]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:319:   instantiated from 'void std::vector<_Tp, _Alloc>::assign(_InputIterator, _InputIterator) [with _InputIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _Tp = double, _Alloc = std::allocator<double>]'
functions_wrap.cxx:3801:   instantiated from 'void swig::assign(const PySeq&, Seq*) [with PySeq = swig::PySequence_Cont<double>, Seq = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3816:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<double, std::allocator<double> >, T = double]'
functions_wrap.cxx:3878:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = double]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3152:   instantiated from 'static bool swig::traits_check<Type, swig::pointer_category>::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3159:   instantiated from 'bool swig::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3763:   instantiated from 'bool swig::PySequence_Cont<T>::check(bool) const [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3820:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3878:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >]'
functions_wrap.cxx:4946:   instantiated from here
functions_wrap.cxx:3138: error: no type named 'category' in 'struct swig::traits<double>'
[jdensmor@ls10977 test]$ g++ -O2 -fPIC -c functions_wrap.cxx -I/usr/include/python2.4 -I/usr/lib/python2.4
functions_wrap.cxx: In function 'bool swig::check(PyObject*) [with Type = double]':
functions_wrap.cxx:3763:   instantiated from 'bool swig::PySequence_Cont<T>::check(bool) const [with T = double]'
functions_wrap.cxx:3820:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<double, std::allocator<double> >, T = double]'
functions_wrap.cxx:3878:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = double]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3152:   instantiated from 'static bool swig::traits_check<Type, swig::pointer_category>::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3159:   instantiated from 'bool swig::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3763:   instantiated from 'bool swig::PySequence_Cont<T>::check(bool) const [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3820:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3878:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >]'
functions_wrap.cxx:4946:   instantiated from here
functions_wrap.cxx:3159: error: no type named 'category' in 'struct swig::traits<double>'
functions_wrap.cxx: In function 'const char* swig::type_name() [with Type = double]':
functions_wrap.cxx:2946:   instantiated from 'static swig_type_info* swig::traits_info<Type>::type_info() [with Type = double]'
functions_wrap.cxx:2953:   instantiated from 'swig_type_info* swig::type_info() [with Type = double]'
functions_wrap.cxx:2987:   instantiated from 'static PyObject* swig::traits_from_ptr<Type>::from(Type*, int) [with Type = double]'
functions_wrap.cxx:2993:   instantiated from 'static PyObject* swig::traits_from<Type>::from(const Type&) [with Type = double]'
functions_wrap.cxx:3005:   instantiated from 'PyObject* swig::from(const Type&) [with Type = double]'
functions_wrap.cxx:3862:   instantiated from 'static PyObject* swig::traits_from_stdseq<Seq, T>::from(const Seq&) [with Seq = std::vector<double, std::allocator<double> >, T = double]'
functions_wrap.cxx:3885:   instantiated from 'static PyObject* swig::traits_from<std::vector<T, std::allocator<_CharT> > >::from(const std::vector<T, std::allocator<_CharT> >&) [with T = double]'
functions_wrap.cxx:3005:   instantiated from 'PyObject* swig::from(const Type&) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3862:   instantiated from 'static PyObject* swig::traits_from_stdseq<Seq, T>::from(const Seq&) [with Seq = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3885:   instantiated from 'static PyObject* swig::traits_from<std::vector<T, std::allocator<_CharT> > >::from(const std::vector<T, std::allocator<_CharT> >&) [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3005:   instantiated from 'PyObject* swig::from(const Type&) [with Type = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >]'
functions_wrap.cxx:6430:   instantiated from here
functions_wrap.cxx:2936: error: 'type_name' is not a member of 'swig::traits<double>'
functions_wrap.cxx: In function 'Type swig::as(PyObject*, bool) [with Type = double]':
functions_wrap.cxx:3563:   instantiated from 'swig::PySequence_Ref<T>::operator T() const [with T = double]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:285:   instantiated from 'static _OI std::__copy<_BoolType, std::random_access_iterator_tag>::copy(_II, _II, _OI) [with _II = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OI = double*, bool _BoolType = false]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:317:   instantiated from '_OI std::__copy_aux(_II, _II, _OI) [with _II = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OI = double*]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:326:   instantiated from 'static _OI std::__copy_normal<<anonymous>, <anonymous> >::copy_n(_II, _II, _OI) [with _II = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OI = double*, bool <anonymous> = false, bool <anonymous> = false]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:387:   instantiated from '_OutputIterator std::copy(_InputIterator, _InputIterator, _OutputIterator) [with _InputIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _OutputIterator = double*]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc:230:   instantiated from 'void std::vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _Tp = double, _Alloc = std::allocator<double>]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:853:   instantiated from 'void std::vector<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator, _InputIterator, __false_type) [with _InputIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _Tp = double, _Alloc = std::allocator<double>]'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h:319:   instantiated from 'void std::vector<_Tp, _Alloc>::assign(_InputIterator, _InputIterator) [with _InputIterator = swig::PySequence_InputIterator<double, const swig::PySequence_Ref<double> >, _Tp = double, _Alloc = std::allocator<double>]'
functions_wrap.cxx:3801:   instantiated from 'void swig::assign(const PySeq&, Seq*) [with PySeq = swig::PySequence_Cont<double>, Seq = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3816:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<double, std::allocator<double> >, T = double]'
functions_wrap.cxx:3878:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = double]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3152:   instantiated from 'static bool swig::traits_check<Type, swig::pointer_category>::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3159:   instantiated from 'bool swig::check(PyObject*) [with Type = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3763:   instantiated from 'bool swig::PySequence_Cont<T>::check(bool) const [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3820:   instantiated from 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3878:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = std::vector<double, std::allocator<double> >]'
functions_wrap.cxx:3030:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >]'
functions_wrap.cxx:4946:   instantiated from here
functions_wrap.cxx:3138: error: no type named 'category' in 'struct swig::traits<double>'

您也未能导出内部向量类型。

%module functions
%{
#include "functions.h"
%}
%include "std_vector.i"
namespace std {
  %template(VecDouble) vector<double>;
  %template(VecVecdouble) vector< vector<double> >;
}

%include "functions.h"

顺便说一句,从 SWIG 生成 -csharp 输出对于您在包装器中创建的类型集来说是一个很好的健全性检查。不懂C#也没关系,看一下名字就可以了*.cs创建的文件。凡是有名字的东西SWIGTYPE_*.cs代表您未包装的类型,以及未来潜在的问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

swig 和 python 的向量<向量 >参数 的相关文章

  • 使用最新值进行采样

    考虑以下系列 created at 2014 01 27 21 50 05 040961 80000 00 2014 03 12 18 46 45 517968 79900 00 2014 09 05 20 54 17 991260 636
  • 在 C++ 中初始化指针

    可以在声明时将指针分配给值吗 像这样的东西 int p 1000 是的 您可以在声明时初始化指向值的指针 但是您不能这样做 int p 1000 是个地址运算符 并且您不能将其应用于常量 尽管如果可以 那会很有趣 尝试使用另一个变量 int
  • 二维数组的列求和

    我有一个IEnumerable
  • 本地主机和 request.Url.Authority

    我的应用程序通过 URL 中的公司标识符分隔用户 company1 app com company2 app com 我正在本地 PC 上进行测试 请求如下 company1 localhost com 但是 我的 request Url
  • C++ 中类型信息何时向后流动?

    我刚刚看了 Stephan T Lavavej 的演讲CppCon 2018关于 类模板参数推导 在哪里某个点 https youtu be H ut6j1BYU t 941他顺便说 在 C 中 类型信息几乎永远不会向后流动 我不得不说 几
  • Pandas 根据条件替换数据框值

    我有一个主数据框 df Colour Item Price Blue Car 40 Red Car 30 Green Truck 50 Green Bike 30 然后我有一个价格修正数据框 df pc Colour Item Price
  • 当 C 中没有足够的内存用于静态分配时会发生什么?

    当您动态分配内存时 例如malloc 1024 sizeof char 结果指针设置为NULL如果没有足够的可用内存来满足请求 当没有足够的内存来满足静态分配时会发生什么 例如char c 1024 char c 1024 不一定是静态分配
  • 为什么 C++20 范围不只提供管道语法?

    我知道这个问题听起来很奇怪 所以这里有一些背景信息 最近 我很失望地了解到 C 20 范围内的映射缩减并不像人们所期望的那样工作 即 const double val data transform accumulate 不起作用 你必须这样
  • 在基本 Tensorflow 2.0 中运行简单回归

    我正在学习 Tensorflow 2 0 我认为在 Tensorflow 中实现最基本的简单线性回归是一个好主意 不幸的是 我遇到了几个问题 我想知道这里是否有人可以提供帮助 考虑以下设置 import tensorflow as tf 2
  • 数据类和属性装饰器

    我一直在阅读 Python 3 7 的数据类 作为命名元组的替代品 我通常在必须将数据分组到结构中时使用它 我想知道数据类是否与属性装饰器兼容 以便为数据类的数据元素定义 getter 和 setter 函数 如果是这样 是否在某处进行了描
  • Xamarin.Android JmDNS 绑定问题

    我开始研究 Xamarin Android 的 JmDNS 绑定 我设法构建了绑定 但无法从代码中引用它 https github com ytn3rd monodroid bindings tree master JmDNS https
  • 从 SUDS 中的 SOAP 响应中提取 Cookie

    我必须使用具有多种服务的 API 所有这些都需要来自下面的身份验证的 JSESSION cookie 然而 当我调用下一个服务时 它不会保留 cookie 因此会拒绝它们 from suds client import Client url
  • 从函数在 python 3 中创建全局变量

    我想知道为什么在函数结束后我无法访问变量 variable for raw data 代码是这样的 def htmlfrom Website URL import urllib request response urllib request
  • 将华氏温度转换为摄氏度的 C 程序始终打印零

    我需要一些关于用 C 语言将华氏温度转换为摄氏度的程序的帮助 我的代码如下所示 include
  • 不兼容的指针到字符转换

    我正在编写一个程序 将卡片值写入 52 个点字符的多维数组中 该程序是一个测试数组 稍后我将其作为函数写入主程序中 在程序中 我通过以下方式初始化 for 循环计数0通过51 我用一个switch语句调制13将卡牌值分配给数组点 但是 我收
  • 为什么 char 数组需要 strcpy 而 char star 不需要 - 在 C 中使用结构

    我对这段代码有一个误解 typedef struct EXP int x char name char lastName 40 XMP main XMP a a name eaaa a lastName strcpy a lastName
  • 使用 QTestLib 时抑制 qDebug

    我正在向 Qt 中的项目添加单元测试 并希望使用 QTestLib 我已经设置了测试并且它们运行良好 问题是在项目中我们重写了 qDebug 以输出到我们自己的日志文件 这在运行应用程序时效果很好 问题是当我测试类时 它有时会开始记录 然后
  • Python 子进程:无法转义引号

    我知道以前曾问过类似的问题 但它们似乎都是通过重新设计参数的传递方式 即使用列表等 来解决的 但是 我这里有一个问题 因为我没有这个选项 有一个特定的命令行程序 我使用的是 Bash shell 我必须向其传递带引号的字符串 它不能不被引用
  • 频繁插入已排序的集合

    我已经对集合 列表 进行了排序 并且我需要始终保持其排序 我目前在我的集合上使用 List BinarySearch 然后在正确的位置插入元素 我也尝试过在每次插入后对列表进行排序 但性能不可接受 有没有一种解决方案可以提供更好的性能 也许
  • 应用非限定名称查找而不是依赖于参数的名称查找

    考虑标准 sec 3 4 1 3 中的一个示例 typedef int f namespace N struct A friend void f A operator int void g A a int i f a f is the ty

随机推荐

  • 描述性 URL 与基本 URL

    我有一个网站 我对所有链接都使用干净的 URL 我想知道人们对简短的基本 URL 与较长的描述性 URL 有何看法 例如 如果我的网站是关于乔治亚斗牛犬足球新闻的 那么哪个网站更适合 SEO 目的 http www example com
  • Vim 正则表达式替换/转义管道字符

    假设我有一行 a b c 我想运行一个正则表达式将其转换为 a b c 在我熟悉的大多数正则表达式引擎中 类似s g应该管用 如果我在 Vim 中尝试这个 我会得到 a b c 事实证明 我在输入这个问题时就找到了答案 无论如何 我将把它与
  • 使用或不使用命名空间::sweep 和/或 Modern::Perl

    In my 最后一个问题 https stackoverflow com q 22598331 632407 Borodin 评论了我的问题 您应该首先删除 Modern Perl 和 namespace sweep 应避免充当编译指示的模
  • 如何使用 OpenCover 和 ReportGenerator 查看单元测试覆盖率结果?

    我对使用 OpenCover 和 ReportGenerator 很陌生 而且在理解如何让它们工作方面我有点费劲 我正在使用 VS NET 2012 专业 这意味着我无权访问内置的单元测试覆盖工具 我还安装了 ReSharper 但不想为
  • 如何获取集群内go Kubernetes客户端的当前命名空间

    如何使用 kubernetes client go API 获取部署 服务的当前命名空间 它似乎不在客户端对象或配置中 Using ioutil ReadFile var run secrets kubernetes io servicea
  • 在 Firefox 中无法以两行显示的工具提示

    我正在添加一个工具提示 br html 的标签 它在 chrome 中运行良好 但在 firefox 中运行不佳 My code var dot svg append g attr class dots selectAll dot data
  • JavaScript 有双浮点数精度吗?

    我知道这是一个奇怪的问题 但是 JavaScript 是否有能力处理双精度浮点数而不是单浮点数 64 位浮点数与 32 位浮点数 JavaScript 中的所有数字都是 64 位浮点数 Ref http www hunlock com bl
  • CATIA VBA 允许在 .CATScript 中使用“Scripting.Dictionary”

    运行 CATScript 时 其代码是从 VBA 环境复制的 并且在 VBA 环境中运行时按预期运行 出现以下错误 脚本引擎报告了以下错误 来源 Microsoft VBScript 运行时错误 描述 变量未定义 脚本 Line 9 列 4
  • 如何返回 Haskell 中给定字母的字母表中的下一个字母 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 这个问题似乎偏离主题 因为它缺乏足够的信息来诊断问题 更详细地描述您的问题或包括一个最小的例子 http stackoverflow co
  • 用图案图像填充 SKShapeNode

    我正在尝试用图像 图案填充 SKShapeNode 但仍然不成功 你能帮我解决这个问题或者给我一个替代方案吗 我想创建一个可碰撞的自定义形状 来自任何 SpriteKit 类型 并填充图案图像 我尝试过以下方法 UIBezierPath p
  • 在 Odoo 中创建新组

    我创建了一个新组 它是一个人员组 但是在查看元数据中 我创建的新组没有 XML ID 我在哪里可以找到 XML ID 或添加新组的 XML ID 即使在外部 ID 中也是如此菜单 我找不到 ID 如何创建或编辑自定义组 打开设置 gt 用户
  • 如何为网站制作一个搜索引擎? [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我想为我的网站安装一个搜索引擎 这些网络搜索引擎 如 Google yahoo 等 是否提供免费服务 或者我应该自己做 Maybe 谷
  • 面向企业的 Google 地图移动 SDK 与 Google 地图 Android API

    我们正在使用 google 地图 android api 2 0 在我们的 android 应用程序中提供地图功能 在我们的应用程序中 谷歌地图将用于捕获和显示以下用例的位置 Whenever a client opens the appl
  • 如何在 TypeScript 中迭代自定义文字类型?

    我在 TypeScript 中定义了一个自定义文字类型 export type Market au br de 现在我想迭代每个可能的Market无需创建数组Market 首先 因为它feels多余的 我可能会忘记添加一个选项 const
  • 使用 wp_insert_post 插入帖子 ID

    插入新帖子时如何选择帖子 ID 例如 post array ID gt 3333 comment status gt open post content gt hi world post name gt title 1 post statu
  • 当输入大小不同时如何进行机器学习?

    在标准食谱机器学习中 我们在矩形矩阵上进行操作 也就是说 我们所有的数据点都具有相同数量的特征 我们如何应对所有数据点具有不同数量特征的情况 例如 如果我们想做视觉分类 但所有图片的维度都不同 或者如果我们想做情感分析 但所有句子都有不同数
  • 按类调用CKEditor

    我需要自动调用 CKEditor 的多个实例 实际上我使用该函数 CKEDITOR replace editor1 其中 editor1 是我想要显示我的 CKEditor 的 div 的 id 名称 我使用 jQuery 来自动化这个过程
  • jQuery 文件下载插件

    我从以下位置导入了这个插件的js文件这个网站 https github com johnculviner jquery fileDownload blob master src Scripts jquery fileDownload js如
  • 在 VB.NET 中解析 Google JSON 响应

    我正在尝试解析 google 的 JSON 响应 这就是我目前所拥有的 Dim x As New System Web Script Serialization JavaScriptSerializer Dim gJson As Strin
  • swig 和 python 的向量<向量 >参数

    我试图弄清楚如何使用 SWIG 来包装一个将 2d 向量返回给 python 的 C 函数 我有文件functions h include