一般信息:我在版本git-Spigot-1d14d5f-ba32592(MC:1.8.3)(实现API版本1.8.3-R0.1-SNAPSHOT),IntelliJ IDEA 14.1.3中使用Bukkit/Spigot API并使用它的默认编译器.java jdk版本是1.8.0_25.
因此,当我尝试调用此类的构造函数时,它会从标题中抛出运行时异常.
package me.lakan.util.inventory;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Map;
@SuppressWarnings("unused") // Util functionality is not always used
public class InventoryMenu implements Listener {
private InventoryType type;
private String title;
private Map<Integer, MenuOption> options;
// Constructors
public InventoryMenu(InventoryType type, String title, JavaPlugin plugin) {
this.options = new HashMap<Integer, MenuOption>();
this.type = type;
this.title = title;
plugin.getServer().getPluginManager().registerEvents(this, …Run Code Online (Sandbox Code Playgroud) 我在Vector_t的initializer_list构造函数上使用std :: copy时遇到问题.但正如您在FixedPoint_t的声明中所看到的,它具有足够的复制构造和赋值声明.编译器对我有什么签名?或者我在这里遗漏了什么?编译器输出指出FixedPoint_t的operator =可能适合,但它仍未使用.匹配参数列表似乎也存在问题.
我试过的:Vector_t适用于整数类型和其他类,因此它必须是FixedPoint_t的一些问题.
在MSDN页显示缺少构造函数.但是FixedPoint_t的ctor匹配.
FixedPoint_t可以在Vector_t之外分配,但我无法得出结论.
我无法使用我制作的int-wrapper重现错误.
编译器:VS编译器(VS 2015)
错误:C2679二进制运算符"=":没有找到类型为"const math :: FixedPoint_t"的rhs参数的运算符(或者没有足够的转换)
#include <FpMath/FpMath.hpp>
using namespace math;
int main(int argc, char** argv) {
// Vector object construction using an initializer_list
Vector_t<FixedPoint_t<int, 4096>, 1> vec {
4096
};
// Assignment outisde of Vector_t
FixedPoint_t<int, 4096> fp1(3 * 4096);
FixedPoint_t<int, 4096> fp2 = fp1; // works
return 0;
}
Run Code Online (Sandbox Code Playgroud)
#pragma once
#include <array>
#include <cassert>
#include <initializer_list>
#include <algortihm> // std::copy
#include "FixedPoint.hpp"
namespace math { …Run Code Online (Sandbox Code Playgroud)