标签: sgi

如何理解向量pop_back的实现?

我目前正在考虑STL为什么以这种方式实现向量pop_back。为什么我们先移动结束指针的序言,然后使用结束指针分配最后一个元素的空间?

void pop_back() {
    --_M_finish;
    destroy(_M_finish);
}
Run Code Online (Sandbox Code Playgroud)

c++ stl vector sgi

6
推荐指数
1
解决办法
140
查看次数

'hash_map'未在此范围内使用g ++ 4.2.1声明

我正在尝试使用sgi hash_map.

#include <list>
#include <iostream>
#include <string>
#include <map>
#include <cstring>
#include <tr1/unordered_map>
#include <ext/hash_map>


using namespace std;
struct eqstr
{
  bool operator()(const char* s1, const char* s2) const
  {
    return strcmp(s1, s2) == 0;
  }
};


int main()
{
  hash_map<const char*, int, hash<const char*>, eqstr> months;

  months["january"] = 31;
  months["february"] = 28;
  months["march"] = 31;
  months["april"] = 30;
  months["may"] = 31;
  months["june"] = 30;
  months["july"] = 31;
  months["august"] = 31;
  months["september"] = 30;
  months["october"] = 31;
  months["november"] = …
Run Code Online (Sandbox Code Playgroud)

c++ sgi

5
推荐指数
2
解决办法
1万
查看次数

是选择模板函数的重载还是函数的部分特化(函数对象)

以下是g ++(STL的sgi版本)的STL实现的摘录.我想知道为什么他们使用部分特化而不是函数重载.

template <class InputIterator, class OutputIterator>
struct __copy_dispatch
{
  OutputIterator operator()(InputIterator first, InputIterator last,
                            OutputIterator result) {
    return __copy(first, last, result, iterator_category(first));
  }
};

//If the inputiterator and the outputiterator is all type T
//This is a partial specialization of the generalized version
template <class T>
struct __copy_dispatch<T*, T*>//-----------------------(1)
{
  T* operator()(T* first, T* last, T* result) {
    typedef typename __type_traits<T>::has_trivial_assignment_operator t; 
    return __copy_t(first, last, result, t());
  }
};

//Strictly speaking this is a partial specialization of the last …
Run Code Online (Sandbox Code Playgroud)

c++ stl generic-programming sgi template-specialization

5
推荐指数
1
解决办法
598
查看次数

如何找出哪个库是给定对象的主页?

我正在使用运行Irix 6.5的SGI上的FORTRAN和C编程,但这应该适用于所有类Unix系统.当我收到"未解决的文本符号"链接错误时,如何找到需要链接到我的程序的库?这是我从链接器中看到的一个例子:

ld32: ERROR  33 Unresolved text symbol "ortho2_" -- first referenced by ./libfoo.a
Run Code Online (Sandbox Code Playgroud)

我只需知道需要哪些库,或者是否有一些工具或命令可以帮助我解决这个问题?

c unix linker fortran sgi

4
推荐指数
1
解决办法
407
查看次数

SGI STL Rope in g ++?

看来我的/usr/include/c++/4.5.1/ext/rope(和ropeimpl.h)中有一个执行绳索.我将它与SGI STL进行了比较,代码似乎与代码库完全相同.

我不知道它的状态或功能与否.我也不知道这是否是超级陈旧的陈旧代码或代码正在进行中

在任何情况下,我都没有找到任何关于如何使用它的参考(如果功能).你知道我错过的东西吗?有可以使用的用法示例吗?

编辑,如果你在这里看到cvs历史,你会看到最后一次活动是4个月前,看起来不是很活跃,但也不会放弃.

c++ stl sgi libstdc++ rope

4
推荐指数
1
解决办法
1893
查看次数

使用imagemagick保存matplotlib动画,不使用ffmpeg或mencoder

我想创建一个计算函数的动画.我无法在我用来运行动画的集群上安装ffmpeg或mencoder,但是安装了imagemagick.matplotlib.animation显然支持imagemagick作为动画的作者(例如,见这里).文档说支持的格式是:

['png', 'jpeg', 'ppm', 'tiff', 'sgi', 'bmp', 'pbm', 'raw', 'rgba']
Run Code Online (Sandbox Code Playgroud)

我认为其中几个是非动画文件类型,但显然ffmpeg .sgi以某种方式支持文件.如果我可以使用ffmpeg或mencoder在我的家用计算机上转换它,那么我必须在cluseter上使用的编解码器是不明智的.

如何使用imagemagick使用matplotlib保存动画?

python animation imagemagick matplotlib sgi

4
推荐指数
1
解决办法
5440
查看次数

为什么我不能使用函数适配器compose2?

我在linux上使用GCC 4.1.2,STL必须是SGI STL.我写完之后:

#include <functional>
 std::find_if(PirateFlush, PirateFlush + size,
                compose2(std::logical_and<bool>(), bind2nd(std::greater<UInt32>(), time),
                    bind2nd(std::less<UInt32>(), now)));
Run Code Online (Sandbox Code Playgroud)

编译说:

错误:'compose2'未在此范围内声明

怎么了?

c++ stl sgi

2
推荐指数
1
解决办法
418
查看次数