C++のTemplate使いこなせてない。
The Complete Guide(2nd Edition)
http://www.tmplbook.com/code/code.html
コンパイルしながら勉強。
勉強の記録
https://researchmap.jp/joqzln3gi-1797580た/#_1797580
だと, qiitaのようにコード表示機能がないためわかりにくい。
<この項は書きかけです。順次追記します。>
Esta sección está por escribirse, la iré agregando poco a poco.
This section is about to be written. I will add it little by little.
compiler
最初はclang++だけで実施。
後日g++をupgradeした時に実施。
clang++
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
g++
g++ (Homebrew GCC 8.1.0) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
コンパイルスクリプト
毎回コンパイル条件を変えてコンパイルするのに、一気にコンパイルする方法
ひとまずbasicsフォルダ内
#!/bin/bash
while read line
do
echo "clang++ $line -std=c++2a -Wall"
clang++ $line -std=c++2a -Wall
if [ -e a.out ]; then
./a.out
rm a.out
fi
done < ./$1
ファイル一覧をbaという名前のファイルで保存。
arrays.cpp
cref.cpp
errornovel1.cpp
errornovel2.cpp
foldtraverse.cpp
foreach.cpp
foreachinvoke.cpp
max1.cpp
max2.cpp
max3ref.cpp
max3val.cpp
max4.cpp
message.cpp
move1.cpp
move2.cpp
myfirst.cpp
myfirstmain.cpp
referror1.cpp
referror2.cpp
specialmemtmpl1.cpp
specialmemtmpl3.cpp
stack1test.cpp
stack3test.cpp
stack9test.cpp
stackauto.cpp
stacknontype.cpp
tmplparamref.cpp
varusing.cpp
同様に、ga.shを作成
#!/bin/bash
while read line
do
echo "g++ $line -std=c++2a -Wall"
g++ $line -std=c++2a -Wall
if [ -e a.out ]; then
./a.out
rm a.out
fi
done < ./$1
cd basics
../ca.sh ba > ba.log.txt &> ba.log.txt
../ga.sh ba > bag.log.txt &> bag.log.txt
cat bag.log.txt >> ba.log.txt
basics
ba.log.txtは下記 researchmapは拡張子logに対応していない。
https://researchmap.jp/mu1t6mv58-45645/?action=multidatabase_action_main_filedownload&download_flag=1&upload_id=160189&metadata_id=25961
basics | clang++ | g++ | ||||||
---|---|---|---|---|---|---|---|---|
error | warning | link error | execute error | error | warning | link error | execute error | |
arrays.cpp | ||||||||
cref.cpp | ||||||||
errornovel1.cpp | 1 | 1 | 1 | 1 | ||||
errornovel2.cpp | 1 | 1 | ||||||
foldtraverse.cpp | 1 | 1 | ||||||
foreach.cpp | ||||||||
foreachinvoke.cpp | ||||||||
max1.cpp | ||||||||
max2.cpp | 1 | |||||||
max3ref.cpp | 3 | 3 | 1 | |||||
max3val.cpp | 3 | 3 | ||||||
max4.cpp | ||||||||
message.cpp | ||||||||
move1.cpp | ||||||||
move2.cpp | ||||||||
myfirst.cpp | 1 | 1 | ||||||
myfirstmain.cpp | 1 | 1 | ||||||
referror1.cpp | 3 | 4 | 2 | |||||
referror2.cpp | 17 | 19 | ||||||
specialmemtmpl1.cpp | ||||||||
specialmemtmpl3.cpp | ||||||||
stack1test.cpp | ||||||||
stack3test.cpp | ||||||||
stack9test.cpp | ||||||||
stackauto.cpp | ||||||||
stacknontype.cpp | ||||||||
tmplparamref.cpp | ||||||||
varusing.cpp |
myfirst.cppとmyfirstmain.cppは一緒にコンパイルする必要があった。
myfirst.cppとmyfirstmain.cppを一緒にコンパイルしてもエラーがあった。
myfirstmain.cppのincludeファイルをmyfirst2.hppに変え、myfirstmain.cppだけでコンパイルしたらコンパイルエラーがなくなった。
そういう題材らしい。
後の、errornovel1.cpp, referror1.cpp, referror2.cppは
ファイル名にあるようにエラーを生成することが目的らしい。
C++ Templates The Complete Guide(2nd Edition) (1) basics/errornovel1.cpp
https://qiita.com/kaizen_nagoya/items/f4dd6ec5fc71e51d8477
C++ Templates The Complete Guide(2nd Edition) (2) referror1.cpp
https://qiita.com/kaizen_nagoya/items/dbd48c3d3b2b250cfa03
C++ Templates The Complete Guide(2nd Edition) (4) inherit/projectioniterator.cpp
https://qiita.com/kaizen_nagoya/items/c8cfcb94e8b3fe499952
C++ Templates The Complete Guide(2nd Edition) (5) inherit/wrapper.cpp
https://qiita.com/kaizen_nagoya/items/8e394f087577201c0419
C++ Templates (6)3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed
C++ Templates The Complete Guide(2nd Edition) (7) deduce/aliastemplate.cpp
https://qiita.com/kaizen_nagoya/items/780332262308f1113cc4
details
cd details
../ca.sh de > de.log.txt &> de.log.txt
../ga.sh de > deg.log.txt &> deg.log.txt
cat deg.log.txt >>de.log.txt
de.log.txt researchmapは拡張子logに対応していないためtxtを付加。
https://researchmap.jp/mucn5h1pu-45645/?action=multidatabase_action_main_filedownload&download_flag=1&upload_id=160199&metadata_id=25961
adl.cpp
fppm.cpp
funcoverload1.cpp
funcoverload2.cpp
implicit.cpp
inject.cpp
lazy2.cpp
max.cpp
nontmpl1.cpp
nontmpl2.cpp
tmplconstr.cpp
tupleoverload.cpp
variadicoverload.cpp
details | clang++ | g++ | ||||||
---|---|---|---|---|---|---|---|---|
error | warning | link error | execution error | error | warning | link error | execution error | |
adl.cpp | ||||||||
fppm.cpp | 1 | 1 | ||||||
funcoverload1.cpp | ||||||||
funcoverload2.cpp | ||||||||
implicit.cpp | 1 | 1 | ||||||
inject.cpp | 1 | |||||||
lazy2.cpp | 1 | 1 | ||||||
max.cpp | ||||||||
nontmpl1.cpp | ||||||||
nontmpl2.cpp | ||||||||
tmplconstr.cpp | ||||||||
tupleoverload.cpp | ||||||||
variadicoverload.cpp |
inherit
cd inherit
../ca.sh in > in.log.txt &> in.log.txt
../ga.sh in > ing.log.txt &> ing.log.txt
cat ing.log.txt >>in.log.txt
countertest.cpp
ebco1.cpp
ebco2.cpp
empty.cpp
equalitycomparable.cpp
projectioniterator.cpp
virtual.cpp
wrapper.cpp
inherit | clang++ | g++ | ||||||
---|---|---|---|---|---|---|---|---|
error | warning | link error | execution error | error | warning | link error | execution error | |
countertest.cpp | ||||||||
ebco1.cpp | ||||||||
ebco2.cpp | 1 | 1 | ||||||
empty.cpp | ||||||||
equalitycomparable.cpp | 1 | 1 | 1 | |||||
projectioniterator.cpp | 5 | 8 | ||||||
virtual.cpp | ||||||||
wrapper.cpp | 1 | 1 |
実行エラーは、Illegal instruction: 4
traits
cd traits
../ca.sh tr > tr.log.txt &> tr.log.txt
../ga.sh tr > trg.log.txt &> trg.log.txt
cat trg.log.txt >>tr.log.txt
tr.log.txtは下記。警告、エラーがない初めての章。
https://researchmap.jp/muv5r7yo6-45645/?action=multidatabase_action_main_filedownload&download_flag=1&upload_id=160208&metadata_id=25961
accum1.cpp
accum6.cpp
decay.cpp
elementtype.cpp
hasmember.cpp
hastype.cpp
isfundatest.cpp
issame.cpp
isvalid1.cpp
isvalid2.cpp
passbyvalue.cpp
rparam1.cpp
rparam2.cpp
sizeof.cpp
traits | clang++ | g++ | ||||||
---|---|---|---|---|---|---|---|---|
error | warning | link error | execution error | error | warning | link error | execution error | |
accum1.cpp | ||||||||
accum6.cpp | ||||||||
decay.cpp | ||||||||
elementtype.cpp | ||||||||
hasmember.cpp | ||||||||
hastype.cpp | ||||||||
isfundatest.cpp | ||||||||
issame.cpp | ||||||||
isvalid1.cpp | ||||||||
isvalid2.cpp | ||||||||
passbyvalue.cpp | ||||||||
rparam1.cpp | ||||||||
rparam2.cpp | ||||||||
sizeof.cpp |
その他
cppファイルが3つ以下のディレクトリはまとめて
cd ..
./ca.sh sm > sm.log.txt &> sm.log.txt
../ga.sh sm > smg.log.txt &> smg.log.txt
cat smg.log.txt >> sm.log.txt
./bridge/forupto1.cpp
./bridge/forupto4.cpp
./debugging/tracertest.cpp
./deduce/aliastemplate.cpp
./deduce/initlist.cpp
./deduce/resulttypetmpl.cpp
./exprtmpl/sarray1.cpp
./exprtmpl/sarray2.cpp
./meta/sqrt1.cpp
./meta/unruh.cpp
./names/anglebrackethack.cpp
./overload/initlist.cpp
./overload/initlistctor.cpp
./overload/initlistovl.cpp
./poly/dynapoly.cpp
./poly/printmax.cpp
./poly/staticpoly.cpp
./tuples/compressedtuple1.cpp
./tuples/indexsort.cpp
./typeoverload/min.cpp
./utils/isconstructible.cpp
./utils/traits1.cpp
./utils/traits2.cpp
clang++ | g++ | |||||||
---|---|---|---|---|---|---|---|---|
error | warning | link error | execution error | error | warning | link error | execution error | |
./bridge/forupto1.cpp | ||||||||
./bridge/forupto4.cpp | 7 | 10 | ||||||
./debugging/tracertest.cpp | ||||||||
./deduce/aliastemplate.cpp | 14 | 21 | ||||||
./deduce/initlist.cpp | 1 | 1 | ||||||
./deduce/resulttypetmpl.cpp | 1 | 1 | ||||||
./exprtmpl/sarray1.cpp | ||||||||
./exprtmpl/sarray2.cpp | 2 | 2 | ||||||
./meta/sqrt1.cpp | ||||||||
./meta/unruh.cpp | 7 | 11 | 1 | 2 | ||||
./names/anglebrackethack.cpp | ||||||||
./overload/initlist.cpp | ||||||||
./overload/initlistctor.cpp | ||||||||
./overload/initlistovl.cpp | ||||||||
./poly/dynapoly.cpp | 2 | 2 | ||||||
./poly/printmax.cpp | ||||||||
./poly/staticpoly.cpp | 4 | 4 | ||||||
./tuples/compressedtuple1.cpp | ||||||||
./tuples/indexsort.cpp | ||||||||
./typeoverload/min.cpp | 20 | 30 | ||||||
./utils/isconstructible.cpp | : | |||||||
./utils/traits1.cpp | 1 | 1 | ||||||
./utils/traits2.cpp |
variant
Chapter 26.
clang++ printrec.cpp -std=c++2a -Wall
printrec.cpp:1:10: fatal error: 'variant-all.hpp' file not found
#include "variant-all.hpp"
^~~~~~~~~~~~~~~~~
variant-all.hppファイルは存在しない。
Kindle版で確認すると文章上は
variant.hpp
担って要る。
ファイル名の最後に-2をつけ
//#include "variant-all.hpp"
#include "variant.hpp"
としてコンパイル
$ cat va-2.log.1st
clang++ printrec-2.cpp -std=c++2a -Wall
In file included from printrec-2.cpp:2:
./variant.hpp:3:12: error: unknown template name 'VariantStorage'
: private VariantStorage<Types...>,
^
./variant.hpp:4:12: error: unknown template name 'VariantChoice'
private VariantChoice<Types, Types...>...
^
./variant.hpp:16:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:17:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&...> visit(Visitor&& vis) &;
^
./variant.hpp:18:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:19:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types const&...> visit(Visitor&& vis) const&;
^
./variant.hpp:20:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:21:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&&...> visit(Visitor&& vis) &&;
^
./variant.hpp:23:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::VariantChoice...;
^
./variant.hpp:23:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::VariantChoice...;
^
;
./variant.hpp:32:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::operator=...;
^
./variant.hpp:32:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::operator=...;
^
;
12 errors generated.
clang++ variant-2.cpp -std=c++2a -Wall
In file included from variant-2.cpp:2:
./variant.hpp:3:12: error: unknown template name 'VariantStorage'
: private VariantStorage<Types...>,
^
./variant.hpp:4:12: error: unknown template name 'VariantChoice'
private VariantChoice<Types, Types...>...
^
./variant.hpp:16:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:17:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&...> visit(Visitor&& vis) &;
^
./variant.hpp:18:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:19:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types const&...> visit(Visitor&& vis) const&;
^
./variant.hpp:20:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:21:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&&...> visit(Visitor&& vis) &&;
^
./variant.hpp:23:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::VariantChoice...;
^
./variant.hpp:23:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::VariantChoice...;
^
;
./variant.hpp:32:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::operator=...;
^
./variant.hpp:32:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::operator=...;
^
;
variant-2.cpp:9:19: error: expected '(' for function-style cast or type construction
if (field.is<int>()) {
~~~^
variant-2.cpp:9:21: error: expected expression
if (field.is<int>()) {
^
variant-2.cpp:10:62: error: expected '(' for function-style cast or type construction
std::cout << "Field stores the integer " << field.get<int>()
~~~^
variant-2.cpp:10:64: error: expected expression
std::cout << "Field stores the integer " << field.get<int>()
^
variant-2.cpp:16:37: error: expected '(' for function-style cast or type construction
<< field.get<std::string>() << '\"' << std::endl;
~~~~~~~~~~~^
variant-2.cpp:16:39: error: expected expression
<< field.get<std::string>() << '\"' << std::endl;
^
18 errors generated.
clang++ variantdefaultctor-2.cpp -std=c++2a -Wall
In file included from variantdefaultctor-2.cpp:2:
./variant.hpp:3:12: error: unknown template name 'VariantStorage'
: private VariantStorage<Types...>,
^
./variant.hpp:4:12: error: unknown template name 'VariantChoice'
private VariantChoice<Types, Types...>...
^
./variant.hpp:16:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:17:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&...> visit(Visitor&& vis) &;
^
./variant.hpp:18:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:19:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types const&...> visit(Visitor&& vis) const&;
^
./variant.hpp:20:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:21:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&&...> visit(Visitor&& vis) &&;
^
./variant.hpp:23:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::VariantChoice...;
^
./variant.hpp:23:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::VariantChoice...;
^
;
./variant.hpp:32:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::operator=...;
^
./variant.hpp:32:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::operator=...;
^
;
variantdefaultctor-2.cpp:8:15: error: expected '(' for function-style cast or type construction
if (v.is<int>()) {
~~~^
variantdefaultctor-2.cpp:8:17: error: expected expression
if (v.is<int>()) {
^
variantdefaultctor-2.cpp:10:29: error: expected '(' for function-style cast or type construction
<< v.get<int>() << '\n';
~~~^
variantdefaultctor-2.cpp:10:31: error: expected expression
<< v.get<int>() << '\n';
^
variantdefaultctor-2.cpp:13:19: error: expected '(' for function-style cast or type construction
if (v2.is<double>()) {
~~~~~~^
variantdefaultctor-2.cpp:13:21: error: expected expression
if (v2.is<double>()) {
^
variantdefaultctor-2.cpp:15:33: error: expected '(' for function-style cast or type construction
<< v2.get<double>() << '\n';
~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
clang++ variantexception-2.cpp -std=c++2a -Wall
In file included from variantexception-2.cpp:2:
./variant.hpp:3:12: error: unknown template name 'VariantStorage'
: private VariantStorage<Types...>,
^
./variant.hpp:4:12: error: unknown template name 'VariantChoice'
private VariantChoice<Types, Types...>...
^
./variant.hpp:16:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:17:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&...> visit(Visitor&& vis) &;
^
./variant.hpp:18:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:19:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types const&...> visit(Visitor&& vis) const&;
^
./variant.hpp:20:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:21:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&&...> visit(Visitor&& vis) &&;
^
./variant.hpp:23:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::VariantChoice...;
^
./variant.hpp:23:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::VariantChoice...;
^
;
./variant.hpp:32:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::operator=...;
^
./variant.hpp:32:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::operator=...;
^
;
variantexception-2.cpp:39:18: error: expected '(' for function-style cast or type construction
if (!v.is<int>() && !v.is<NonCopyable>()) {
~~~^
variantexception-2.cpp:39:20: error: expected expression
if (!v.is<int>() && !v.is<NonCopyable>()) {
^
variantexception-2.cpp:39:31: error: 'NonCopyable' does not refer to a value
if (!v.is<int>() && !v.is<NonCopyable>()) {
^
variantexception-2.cpp:11:7: note: declared here
class NonCopyable
^
variantexception-2.cpp:39:44: error: expected expression
if (!v.is<int>() && !v.is<NonCopyable>()) {
^
16 errors generated.
clang++ variantpromote-2.cpp -std=c++2a -Wall
In file included from variantpromote-2.cpp:2:
./variant.hpp:3:12: error: unknown template name 'VariantStorage'
: private VariantStorage<Types...>,
^
./variant.hpp:4:12: error: unknown template name 'VariantChoice'
private VariantChoice<Types, Types...>...
^
./variant.hpp:16:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:17:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&...> visit(Visitor&& vis) &;
^
./variant.hpp:18:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:19:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types const&...> visit(Visitor&& vis) const&;
^
./variant.hpp:20:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:21:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&&...> visit(Visitor&& vis) &&;
^
./variant.hpp:23:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::VariantChoice...;
^
./variant.hpp:23:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::VariantChoice...;
^
;
./variant.hpp:32:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::operator=...;
^
./variant.hpp:32:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::operator=...;
^
;
variantpromote-2.cpp:11:56: error: expected '(' for function-style cast or type construction
std::cout << "v2 contains the integer " << v2.get<int>() << '\n';
~~~^
variantpromote-2.cpp:11:58: error: expected expression
std::cout << "v2 contains the integer " << v2.get<int>() << '\n';
^
variantpromote-2.cpp:15:58: error: expected '(' for function-style cast or type construction
std::cout << "v3 contains the double " << v3.get<double>() << '\n';
~~~~~~^
variantpromote-2.cpp:15:60: error: expected expression
std::cout << "v3 contains the double " << v3.get<double>() << '\n';
^
16 errors generated.
clang++ visit-2.cpp -std=c++2a -Wall
In file included from visit-2.cpp:2:
./variant.hpp:3:12: error: unknown template name 'VariantStorage'
: private VariantStorage<Types...>,
^
./variant.hpp:4:12: error: unknown template name 'VariantChoice'
private VariantChoice<Types, Types...>...
^
./variant.hpp:16:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:17:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&...> visit(Visitor&& vis) &;
^
./variant.hpp:18:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:19:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types const&...> visit(Visitor&& vis) const&;
^
./variant.hpp:20:25: error: unknown type name 'ComputedResultType'
template<typename R = ComputedResultType, typename Visitor>
^
./variant.hpp:21:5: error: no template named 'VisitResult'
VisitResult<R, Visitor, Types&&...> visit(Visitor&& vis) &&;
^
./variant.hpp:23:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::VariantChoice...;
^
./variant.hpp:23:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::VariantChoice...;
^
;
./variant.hpp:32:9: error: using declaration requires a qualified name
using VariantChoice<Types, Types...>::operator=...;
^
./variant.hpp:32:22: error: expected ';' after using declaration
using VariantChoice<Types, Types...>::operator=...;
^
;
12 errors generated.
現在、cppファイルにhppファイルのincludeを追記中。
1. 分かったこと
コンパイルエラーを出すことが目的のファイル(なんちゃらerror.cpp)がある。
2つのファイルをコンパイルする必要のあるファイル(myfirst.cpp)がある
ヘッダファイルを切り替えてコンパイルするファイルがある。
2. 分からなかったこと
Templateの本質
3. 良かったこと
最初にコンパイルエラーが出た4つのうち1つはコンパイルエラーが取れた。
後の3つはコンパイルエラーを出すことが目的だったらしい。
4. 改めること
全体をコンパイルして結果を集計する記述または枠組(framework)
参考文献(reference)
プログラミング言語教育のXYZ
https://qiita.com/kaizen_nagoya/items/1950c5810fb5c0b07be4
プログラミング言語教育のXYZ(youtube)
https://www.youtube.com/watch?v=He1_tg4px-w&t=486s
C++N4741 2018
Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4741.pdf
C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
https://qiita.com/kaizen_nagoya/items/3294c014044550896010
C++N4606 2016
Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
C++N4606, 2016符号断片編纂一覧(example code compile list)
Working Draft 2016, ISO/IEC 14882(1)
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/
CEDD(Compile Error Driven Design)
初めての CEDD(Compile Error Driven Design) 8回直してコンパイル。
https://qiita.com/kaizen_nagoya/items/9494236aa1753f3fd1e1
コンパイルエラーを記録するとよい理由7つ
https://qiita.com/kaizen_nagoya/items/85c0e92b206883140e89
C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9
C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a
Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d
C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da
[C][C++]の国際規格案の例題をコンパイルするときの課題7つ。
https://qiita.com/kaizen_nagoya/items/5f4b155030259497c4de
docker gnu(gcc/g++) and llvm(clang/clang++)
https://qiita.com/drafts/059874ea39c4de64c0f7
一覧
物理記事 上位100
https://qiita.com/kaizen_nagoya/items/66e90fe31fbe3facc6ff
量子(0) 計算機, 量子力学
https://qiita.com/kaizen_nagoya/items/1cd954cb0eed92879fd4
数学関連記事100
https://qiita.com/kaizen_nagoya/items/d8dadb49a6397e854c6d
言語・文学記事 100
https://qiita.com/kaizen_nagoya/items/42d58d5ef7fb53c407d6
医工連携関連記事一覧
https://qiita.com/kaizen_nagoya/items/6ab51c12ba51bc260a82
自動車 記事 100
https://qiita.com/kaizen_nagoya/items/f7f0b9ab36569ad409c5
通信記事100
https://qiita.com/kaizen_nagoya/items/1d67de5e1cd207b05ef7
日本語(0)一欄
https://qiita.com/kaizen_nagoya/items/7498dcfa3a9ba7fd1e68
英語(0) 一覧
https://qiita.com/kaizen_nagoya/items/680e3f5cbf9430486c7d
転職(0)一覧
https://qiita.com/kaizen_nagoya/items/f77520d378d33451d6fe
仮説(0)一覧(目標100現在40)
https://qiita.com/kaizen_nagoya/items/f000506fe1837b3590df
Qiita(0)Qiita関連記事一覧(自分)
https://qiita.com/kaizen_nagoya/items/58db5fbf036b28e9dfa6
鉄道(0)鉄道のシステム考察はてっちゃんがてつだってくれる
https://qiita.com/kaizen_nagoya/items/26bda595f341a27901a0
安全(0)安全工学シンポジウムに向けて: 21
https://qiita.com/kaizen_nagoya/items/c5d78f3def8195cb2409
一覧の一覧( The directory of directories of mine.) Qiita(100)
https://qiita.com/kaizen_nagoya/items/7eb0e006543886138f39
Ethernet 記事一覧 Ethernet(0)
https://qiita.com/kaizen_nagoya/items/88d35e99f74aefc98794
Wireshark 一覧 wireshark(0)、Ethernet(48)
https://qiita.com/kaizen_nagoya/items/fbed841f61875c4731d0
線網(Wi-Fi)空中線(antenna)(0) 記事一覧(118/300目標)
https://qiita.com/kaizen_nagoya/items/5e5464ac2b24bd4cd001
OSEK OS設計の基礎 OSEK(100)
https://qiita.com/kaizen_nagoya/items/7528a22a14242d2d58a3
Error一覧 error(0)
https://qiita.com/kaizen_nagoya/items/48b6cbc8d68eae2c42b8
プログラマによる、プログラマのための、統計(0)と確率のプログラミングとその後
https://qiita.com/kaizen_nagoya/items/6e9897eb641268766909
官公庁・学校・公的団体(NPOを含む)システムの課題、官(0)
https://qiita.com/kaizen_nagoya/items/04ee6eaf7ec13d3af4c3
「はじめての」シリーズ ベクタージャパン
https://qiita.com/kaizen_nagoya/items/2e41634f6e21a3cf74eb
AUTOSAR(0)Qiita記事一覧, OSEK(75)
https://qiita.com/kaizen_nagoya/items/89c07961b59a8754c869
プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945
LaTeX(0) 一覧
https://qiita.com/kaizen_nagoya/items/e3f7dafacab58c499792
自動制御、制御工学一覧(0)
https://qiita.com/kaizen_nagoya/items/7767a4e19a6ae1479e6b
Rust(0) 一覧
https://qiita.com/kaizen_nagoya/items/5e8bb080ba6ca0281927
小川清最終講義、最終講義(再)計画, Ethernet(100) 英語(100) 安全(100)
https://qiita.com/kaizen_nagoya/items/e2df642e3951e35e6a53
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
Este artículo es una impresión personal basada en la experiencia personal. No tiene nada que ver con la organización o empresa a la que pertenezco actualmente.
This article is an individual impression based on the individual's experience. It has nothing to do with the organization or business to which I currently belong.
文書履歴(document history)
ver 0.10 初稿 20180506
ver 0.11 bridge追記 20180506
ver 0.12 cdコマンド追記 20180508
ver 0.20 g++追記 20180509
ver 0.21 variantフォルダのコンパイル途中結果を記載 20180510
ver 0.22 一覧にフォルダ名を追記 20180515
ver 0.23 basics/errornovel1.cpp URL追記 20180614
ver 0.24 参考文献、コンパイルURL追記 20180616
最後までおよみいただきありがとうございました。
いいね 💚、フォローをお願いします。
Muchas gracias por leer hasta la última frase.
Thank you very much for reading to the last sentence.
Por favor presiona el ícono Me gusta 💚. Y sígueme para tu vida feliz.
Please press the like icon 💚 and follow me for your happy life.