09/06/14 22:33:31
オーバーロードというのは
template <class T> void Function(T x, boost::type<Hoge>/*ダミー*/);
template <class T> void Function(T x, boost::type<Fuga>/*ダミー*/);
っていうこと。
661:658
09/06/15 07:05:57
>>659
ふーん、なるほど。
Boostでやたら多用されているのも分かる気がしてきた。
662:デフォルトの名無しさん
09/06/15 21:47:30
素朴な疑問です。
shared_ptrやscoped_ptrには下記のオペレータがあります。
T& operator*() const;
T* operator->() const;
実装から考えれば全くその通りだと思います。
でも生ポインタを抽象化するという役割を考えると、
下記の方が理にかなっているように思えてなりません。
const T& operator*() const;
const T* operator->() const;
T& operator*();
T* operator->();
後者がNGで、前者でなければならない理由とかがあるのでしょうか?
663:デフォルトの名無しさん
09/06/15 21:50:02
T const* と T* const の違いを考えてみればいい。
664:デフォルトの名無しさん
09/06/15 22:15:29
>>663
なるほど!
確かにポインタ自身のconstを考えると納得です。
すっきりしました。
ありがとうございました。
665:デフォルトの名無しさん
09/06/16 15:07:43
継続はいつ実装されるんだ
666:デフォルトの名無しさん
09/06/20 22:21:29
更新しました。
URLリンク(booster.x0.to)
以下更新内容の一部
[Graph]
Changed function types to enums and removed include of iostream; refs #3134
Added constructors from multi-pass unsorted, filtered edge lists; refs #3134
Added extra named parameters for McGregor maximal common subgraph algorithm; contributed by Michael Hansen; refs #3134
[Functional]
Try to avoid float to int warning when a float function doesn't exist. Refs #3171.
[Spirit]
Spirit: Added operator safe_bool to lexer token type
Spirit: Simplified multi_pass iterator
Spirit: Fixing bogus assertions
Fixup to add() again for Hartmut.
Spirit: Made dummy token constructor explicit
[Random]
Supress warnings from narrowing conversions.
[Fusion]
introduces unfused adapter
fix trac issue #1608
[Proto]
accomodate fusion:vector0 interface change
[Graph_parallel]
Fixed bugs in test case; refs #3134
Fixed warnings; refs #3134
[Python]
Use appropriate default values for global and local dicts.
[Impl]
Fixed support for CRT hooks, it was not working properly with catch_system_errors=no
667:デフォルトの名無しさん
09/06/20 22:38:49
これは乙じゃなくてなんたらかんたら
668:デフォルトの名無しさん
09/06/27 05:07:54
program optionsライブラリって機能の割にはコンパイルしてlib用意しなきゃダメなんだね
OSに依存することやってるわけでもなさそうなのに何故なんだぜ?
669:デフォルトの名無しさん
09/06/27 10:26:24
コンパイラに依存することやってたと思った
670:デフォルトの名無しさん
09/06/27 19:08:43
>>668
テンプレートやインライン関数でないものを含んでいるんじゃないの
671:デフォルトの名無しさん
09/06/27 20:44:52
program_optionsのファイル読み込みはいらないよなぁ
シリアライズの方が手っ取り早いし、ちゃんとやるならspirit使うし
672:デフォルトの名無しさん
09/06/27 21:53:00
program_optionsはBoostに含まれるにしては割と
出来が良くない気がする。
まあライセンスが緩いBoostだから、いっぱいあるのは俺は歓迎だけどさ。
673:progress_display
09/06/27 22:16:05
俺もそう思う
674:program_options
09/06/27 22:36:10
>>673
お前にだけは言われたくない
675:672
09/06/27 22:38:28
>>674
まあまあ。
喧嘩うるなよ。
676: ◆/91kCCQXBo
09/06/28 01:39:40
>>113 ソートのアルゴリズムは習ってないということで。
#include <stdio.h>
#include <stdlib.h>
struct seiseki {
char name[20];
int order[6];
} seito[] =
{{"太郎",80,90,75,70,70}, {"次郎",70,85,80,80,85}, {"三郎",75,95,65,90,95}, {"四郎",65,70,80,75,80},
{"春子",90,100,85,90,85},{"夏子",100,95,80,85,80}, {"秋子",60,75,90,70,85}, {"冬子",85,80,85,90,95}};
int kamoku;
int cmp(const struct seiseki *a, const struct seiseki *b) {
int t = a->order[kamoku] - b->order[kamoku];
return (t==0)?0:(t>0?1:-1);
}
int main() {
int i, array_size = sizeof(seito)/sizeof(*seito);
char s_kamoku[6][10] = {"国語","算数","理科","社会","英語","合計"};
for(i=0; i<array_size; i++) {
seito[i].order[5] = seito[i].order[0] + seito[i].order[1] +
seito[i].order[2] + seito[i].order[3] + seito[i].order[4];
printf("%s,%3d,%3d,%3d,%3d,%3d,%4d\n", seito[i].name, seito[i].order[0], seito[i].order[1],
seito[i].order[2], seito[i].order[3], seito[i].order[4], seito[i].order[5]);
}
for(kamoku=5; kamoku>=0; kamoku--) {
printf("\n%sの点数で並び替え\n", s_kamoku[kamoku]);
qsort(seito, array_size, sizeof(*seito), (int (*)(const void*, const void*))cmp );
for(i=0; i<array_size; i++) {
printf("%s,%3d,%3d,%3d,%3d,%3d,%4d\n", seito[i].name, seito[i].order[0], seito[i].order[1],
seito[i].order[2], seito[i].order[3], seito[i].order[4], seito[i].order[5]);
}
} return 0;
}
677:デフォルトの名無しさん
09/06/28 01:42:34
宿題スレの誤爆?
678:shared_ptr
09/06/28 08:25:16
includeするだけで使えるってのがウリの一部だというのに・・
本当使えないなモマイラは
679:mpl
09/06/28 11:56:22
>>678
あんなクソでかいライブラリをコンパイルするのなんて待ってられないよなw
680:spirit
09/06/28 15:46:58
同意
681:デフォルトの名無しさん
09/06/28 16:10:57
おまいらおもろいなw
682:noncopyable
09/06/28 17:27:03
>>678 >>679 >>680
おまえら、俺様の前に跪けよな。
683:xpressive
09/06/28 20:32:19
regexはいらない子
684:デフォルトの名無しさん
09/06/28 20:38:01
regexの方がコンパイル速度速いだろ?
685:デフォルトの名無しさん
09/06/28 20:41:15
>>684
俺は
「Boost.Regexは動的正規表現だから、
ユーザーに正規表現文字列を入力してもらって
動的な検索を提供できるのでは」
と思っているのだが。
そんな機会が無くて試したこと無いけど。
Boost.Xpressiveもいる子
686:デフォルトの名無しさん
09/06/28 20:51:01
xpressiveにも動的正規表現処理はあるんだよ。
687:デフォルトの名無しさん
09/06/28 20:54:31
>>686
マジか!
じゃあもうBoost.Regexは…
…いや、なんでもない。
688:デフォルトの名無しさん
09/06/28 21:04:41
残念ながらC++0xに採用されるのはboost::regexなのだよ。
689:parameter
09/06/28 21:17:07
お前らあまりprogram_optionsいじめるなよ
690:boost::tuple
09/06/28 21:28:29
tr1にも入ってるし、僕はいる子ですよね!
691:687
09/06/28 21:29:53
tr1に入るのがBoost.Regexなのは、
歴史的な理由?
つまりある程度枯れているから信頼性があるとか?