小编Dav*_*ter的帖子

Prolog,访问列表的特定成员?

任何人都可以告诉我如何访问prolog列表中的特定成员?比方说,我需要访问传递给规则的列表的第3或第4个元素?

list prolog unification

18
推荐指数
2
解决办法
3万
查看次数

捕获null异常

我正在研究一个用于android的java应用程序,我现在遇到一个问题,调试器正在进入我的catch块,不知何故ex为null?以前有人见过这样的事吗?

}
catch(Exception ex)
{
   // Debugger is coming through the catch block and ex is null ????
}
Run Code Online (Sandbox Code Playgroud)

java eclipse android exception

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

boost 程序选项使用已弃用的功能

我通过 vcpkg 安装了 boost-program-options 版本 1.78。当我编译时clang++-std=c++20出现以下错误。当我用 编译时不会发生这种情况g++。据此,从 C++11 开始,这已被弃用。 std::unary_function

In file included from /home/david/C/vcpkg/installed/x64-linux/include/boost/program_options/variables_map.hpp:12:
In file included from /home/david/C/vcpkg/installed/x64-linux/include/boost/any.hpp:20:
In file included from /home/david/C/vcpkg/installed/x64-linux/include/boost/type_index.hpp:29:
In file included from /home/david/C/vcpkg/installed/x64-linux/include/boost/type_index/stl_type_index.hpp:47:
/home/david/C/vcpkg/installed/x64-linux/include/boost/container_hash/hash.hpp:132:33: warning: 'unary_function<const std::error_category *, unsigned long>' is deprecated [-Wdeprecated-declarations]
        struct hash_base : std::unary_function<T, std::size_t> {};
                                ^
/home/david/C/vcpkg/installed/x64-linux/include/boost/container_hash/hash.hpp:692:18: note: in instantiation of template class 'boost::hash_detail::hash_base<const std::error_category *>' requested here
        : public boost::hash_detail::hash_base<T*>
                 ^
/home/david/C/vcpkg/installed/x64-linux/include/boost/container_hash/hash.hpp:420:24: note: in instantiation of template class 'boost::hash<const std::error_category *>' …
Run Code Online (Sandbox Code Playgroud)

c++ clang unary-function c++11

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

C++ 11所有控制路径是否仍然需要返回值?

这似乎是一个荒谬的问题,但今天我用C++编写了一个成员函数,该函数应该返回并返回int但并非总是如此.我甚至写了一个非常简单的函数,它没有返回值......

int derp()
{
    if (11 == 22) return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是最近的变化吗?我的编译器坏了吗?大声笑

编辑:这确实编译顺便说一句

c++ visual-c++ c++11

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

OS X Lion上的install_name_tool

我正在运行OS 10.7.4并且找不到install_name_tool.我通过App Store安装了Xcode 4.3.3.有谁知道我在哪里可以找到/获取install_name_tool?

macos xcode install-name-tool

3
推荐指数
1
解决办法
4570
查看次数

使用typedef结构时,错误'类型为"X*"的值无法分配给"X*"类型的实体

这是我用于节点的结构...

typedef struct
{
    struct Node* next;
    struct Node* previous;
    void* data;
} Node;
Run Code Online (Sandbox Code Playgroud)

这是我用来链接它们的功能

void linkNodes(Node* first, Node* second)
{
    if (first != NULL)
        first->next = second;

    if (second != NULL)
        second->previous = first;
}
Run Code Online (Sandbox Code Playgroud)

现在,visual studio在这些行上给了我intellisense(less)错误

IntelliSense: a value of type "Node *" cannot be assigned to an entity of type "Node *"
Run Code Online (Sandbox Code Playgroud)

任何人都可以解释这样做的正确方法吗?Visual Studio将编译它并运行它查找它也可以在我的Mac上运行但是在我的学校服务器上崩溃.

编辑:我想使用memcpy,但这很可怕

c struct typedef compiler-errors

3
推荐指数
1
解决办法
8817
查看次数

C++模板化,静态分配的数组

我正在尝试为项目做这样的事......

template <class N> class MyClass { float properties[N]; };

无论如何在C++中实现这一点?

c++ arrays templates allocation

0
推荐指数
1
解决办法
186
查看次数