我正在尝试创建一个设置 LinkedList 根节点的函数。但是,当我运行以下代码时:
\n\n#include <iostream>\nusing namespace std;\n\ntemplate <typename K>\nstruct Node {\n Node<K>* next;\n const K value;\n};\n\ntemplate <typename K>\nNode<K>* root = NULL;\n\ntemplate <typename K>\nvoid SetRoot(const K &key) {\n Node<K> new_node = Node<K> {NULL, key};\n root = &new_node;\n}\n\nint main(int argc, char *argv[])\n{\n Node<int> n1 = Node<int> {NULL, 48};\n SetRoot(n1);\n\n return 0;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我在该行收到此错误root = &new_node;:
\n\n\n错误: \xe2\x80\x98=\xe2\x80\x99 令牌根 = &new_node; 之前缺少模板参数;
\n
但是,new_node确实具有 struct 的所有预期参数Node。
我试图通过存储在 EBX 寄存器中的数量来移动存储在 EAX 寄存器中的数字。但是,当我尝试使用以下 shift 语句执行我的程序时:
shll %ebx, %eax
Run Code Online (Sandbox Code Playgroud)
我在编译时检索到以下错误:
错误:“shl”的操作数类型不匹配
根据我的理解,我对这个错误的含义感到困惑,将寄存器引用作为参数传递应该是移位函数的正确用法。
我正在编写一个程序,它递归地迭代列表,提供当前字符的索引和字符列表。但是,当我运行以下程序时:
(defun printAllElementsRecursively (index providedList)
(if (>= index (length providedList))
(return-from printAllElementsRecursively NIL)
)
(defvar currCharacter (nth index providedList))
(print (format nil "Character at index ~a: ~a" index currCharacter))
(printAllElementsRecursively (+ index 1) providedList)
)
(printAllElementsRecursively 0 '(A B B A))
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
"Character at index 0: A"
"Character at index 1: A"
"Character at index 2: A"
"Character at index 3: A"
Run Code Online (Sandbox Code Playgroud)
考虑到 的值index确实正确增加,这看起来很奇怪。
我正在尝试设置按钮样式,使其没有边框半径。我曾尝试将该radius属性设置为0sp,但这不起作用。下面是我的代码和结果按钮的屏幕截图,它仍然有圆角。
<com.google.android.material.button.MaterialButton
android:id="@+id/material_text_button"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:textAppearance="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_marginTop="11sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:radius="0sp"
android:text="#1 Lorem Ipsum"
android:textSize="16sp"/>
Run Code Online (Sandbox Code Playgroud)
android android-button android-studio material-components material-components-android