我一直在研究一个链表模板类,用各种变量做同样的事情,并设法解决大部分问题.除非我编译,我得到这些:
g++ -Wall -o template_test template_test.cpp
In file included from template_test.cpp:1:0:
LinkedList.h:50:11: error: declaration of ‘class Type’
LinkedList.h:7:11: error: shadows template parm ‘class Type’
LinkedList.h:51:30: error: invalid use of incomplete type ‘class LinkedList<Type>’
LinkedList.h:8:7: error: declaration of ‘class LinkedList<Type>’
LinkedList.h:56:11: error: declaration of ‘class Type’
LinkedList.h:7:11: error: shadows template parm ‘class Type’
LinkedList.h:57:51: error: invalid use of incomplete type ‘class LinkedList<Type>’
LinkedList.h:8:7: error: declaration of ‘class LinkedList<Type>’
LinkedList.h:92:11: error: declaration of ‘class Type’
LinkedList.h:7:11: error: shadows template parm ‘class Type’ …Run Code Online (Sandbox Code Playgroud) 我有一个像这样定义的列表:
(define testlist '((Dog <=> Cat)
(Anne <=> Dodd))
Run Code Online (Sandbox Code Playgroud)
有没有办法转:(car testlist)进入一个字符串所以我可以使用regexp来搜索"<=>"?