本文整理汇总了C++中boost::python::list::pop方法的典型用法代码示例。如果您正苦于以下问题:C++ list::pop方法的具体用法?C++ list::pop怎么用?C++ list::pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::python::list
的用法示例。
在下文中一共展示了list::pop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
bool PythonSignal::open(boost::python::list macAddress) {
BOOST_VERIFY(mpSignal != 0);
uint8_t mac[6] = {0,0,0,0,0,0};
if(boost::python::extract<size_t>(macAddress.attr("__len__")()) >= 6) {
for (int i = 5; i >= 0; i--) {
mac[i] = boost::python::extract<uint8_t>(macAddress.pop());
}
}
return mpSignal->open(mac);
}
示例2: mpi_init
bool mpi_init(boost::python::list python_argv)
{
using boost::python::extract;
using boost::python::object;
// If already initialized, do nothing but note that initialization
// is done.
int flag = 0;
int result = MPI_Initialized(&flag);
assert(result == MPI_SUCCESS);
if (flag) return false;
// Convert Python argv into C-style argc/argv. Ewwwww!
int my_argc = extract<int>(python_argv.attr("__len__")());
char** my_argv = new char*[my_argc];
for (int arg = 0; arg < my_argc; ++arg)
my_argv[arg] = strdup(extract<const char*>(python_argv[arg]));
// Initialize MPI
int mpi_argc = my_argc;
char** mpi_argv = my_argv;
result = MPI_Init(&mpi_argc, &mpi_argv);
assert(result == MPI_SUCCESS);
// If anything changed, convert C-style argc/argv into Python argv
if (mpi_argv != my_argv) {
// Tear down Python argv
while (int(extract<int>(python_argv.attr("__len__")())) > 0)
python_argv.pop();
// Build up new Python argv
for (int arg = 0; arg < mpi_argc; ++arg)
python_argv.append(object(mpi_argv[arg]));
}
for (int arg = 0; arg < my_argc; ++arg)
free(my_argv[arg]);
delete [] my_argv;
return true;
}