result_ofとcv-qualification

http://lists.boost.org/MailArchives/boost-users/msg07012.php
どーりで変だと思った.関数型の引数においてtop-levelのconstが無視される(下記『参考』参照)から,引数の型のcv-qualificationの違いが戻り値の型に影響を与える場合どうやってresult_of(result内部型)を定義させようとしているのか不思議で仕方なかったんだけど,よーするにnon-const lvalue, const lvalue, rvalueの3つで各々部分特殊化しろってことかな?
(const-)lvalueかrvalueかは関数の外側の問題だからこの差異をファンクタ内部で考慮するのって微妙に変な気もするし(というかしんどい),一方で外側でremove_referenceとかやらなくて良いから楽だともいえるし・・・.
#ところでboost::transform_iteratorってまだresult_ofに対応してなかったハズじゃ・・・?>対応してなかった>でもReferenceを明示的に指定すればUnaryFunction::result_typeを探しに行かない(lazyに評価してる)のでユーザがReferenceをresult_ofを使って明示的にしてやればオッケー
#result_ofが採用している方針の方がbetterな気がしてきた
#これ周りでコンパイラの挙動が理解できずにコンパイラのバグだと思っていたけれど,やっぱり自分の理解が不足していただけでした,と.疑うべきものの順番を間違えちゃあダメですな

参考

8.3.5 Functions
3 A single name can be used for several different functions in a single scope; this is function overloading (clause 13). All declarations for a function with a given parameter list shall agree exactly both in the type of the value returned and in the number and type of parameters; the presence or absence of the ellipsis is considered part of the function type. The type of a function is determined using the following rules. The type of each parameter is determined from its own decl-specifier-seq and declarator. After determining the type of each parameter, any parameter of type "array of T" or "function returning T" is adjusted to be "pointer to T" or "pointer to function returning T," respectively. After producing the list of parameter types, several transformations take place upon these types to determine the function type. Any cv-qualifier modifying a parameter type is deleted. [Example: the type void(*)(const int) becomes void(*)(int) —end example] Such cv-qualifiers affect only the definition of the parameter within the body of the function; they do not affect the function type. If a storage-class-specifier modifies a parameter type, the specifier is deleted. [Example: register char* becomes char* —end example] Such storage-class-specifiers affect only the definition of the parameter within the body of the function; they do not affect the function type. The resulting list of transformed parameter types is the function’s parameter type list.