stl

    2热度

    2回答

    我认为以下减少的C++ 11代码应该是有效的。 unordered_map<string,string> test; auto it = remove_if(test.begin(), test.end(), [] (const decltype(test)::value_type &entry) { return true; }); 但是它失败克++ 6.3编译,抱怨的std :

    0热度

    1回答

    我们使用了freebsd gcc编译器。我说过很多错误之后使用了cmake命令。 有: OBJDIR/GAuthServer.o: In function `GAuthServer::OnMySQLConnect(std::weak_ptr<GAuthServer>, boost::system::error_code const&)': /mainline/Server/auth/src/GA

    4热度

    1回答

    我有一个案例,我的算法的决定是基于共享的深度std::recursive_mutex。 #include <iostream> #include <mutex> #include <thread> int g_i = 0; std::recursive_mutex g_i_mutex; void bar() { std::lock_guard<std::recursive_

    2热度

    1回答

    我要声明,接受不同的STL容器的功能,但它们必须包含特定的类的对象(例如,它应该接受std::vector<double>和std::deque<double>但没有std::vector<std::string>)。 我已经找到了模板的容器和包含的类型的答案,但我尝试调整它们以便包含的类型是固定的不成功。

    1热度

    1回答

    给定一个C++ std::istream输入内存流,是否可以以任何方式直接将该流中的数据写入C文件流(FILE*),而无需先将数据写入磁盘? 我问的原因是我有一个C接口采取FILE*,为此我想透明地支持压缩或未压缩的输入文件。 这个想法是编写一个包装函数,它接受输入文件,然后使用boost::iostreams创建一个过滤流,在必要时执行解压缩,然后将解压缩的数据以某种方式转发给C API。 直接

    -1热度

    1回答

    我按照以下条件对C++ stl关联容器进行分类(set,map)(normal,multi)(ordered,unordered)。 有8个案例(2 * 2 * 2)。 设置 多重集 unordered_multiset (有序)多集 设置 unordered_set (有序)设置 地图 多重映射 unordered_multimap (有序)多重映射 地图 unordered_map (有序)地

    3热度

    3回答

    考虑以下示例代码初始化: 实施例: void print(int n) { cout << "element print\n"; } void print(vector<int> vec) { cout << "vector print\n"; } int main() { /* call 1 */ print(2); /* call 2 */

    -1热度

    1回答

    std::priority_queue<int, vector<int>, std::greater<int> > pq; 我不明白性病的工作::越大优先级队列。 我正在用优先级队列替换minheap。 此代码取自 geeksForGeeks implementation of Prims algorithm using STL

    0热度

    1回答

    因此,我有一个程序读取文件,并通过使用std::map并将int作为关键字和std::vector作为值来获取最大单词。我需要打印出最大的单词,但在排序时遇到问题。而输出应该是版权,出版,通用,蓝图 我得到:蓝图,版权,通用,出版 我该如何解决这个问题?矢量不是大写还是小写? 这是我到目前为止有: string temp; stringstream ss(line); while(ss >>

    0热度

    1回答

    我在使用宏_NOEXCEPT_PO的STL(set,vector,deque等)中收到很多错误。在Visual Studio 2010中编译的代码相同,其STL不包含_NOEXCEPT_PO宏。我在三台PC上复制了这个错误。是否需要了解其他预处理定义?鉴于 错误是: C:\ Program Files文件(x86)的\微软的Visual Studio 14.0 \ VC \包括\矢量:852:警告