Visual Studio 2005 と Boost 1.37 を使用しています。Visual Studio 2012 Express Desktop と Boost 1.50 でも同じコードをテストしましたが、成功しませんでした。
タイプのカスタム添え字演算子にアクセスして、 Boost.Lambdaを使用したいと考えています。std::arrayで使用する場合にも発生するため、 std::arrayタイプの問題を説明します。
#include <vector>
#include <array>
#include <algorithm>
int main() {
std::vector<std::array<int, 3>> arrays;
arrays.push_back(make_array(1, 2, 3));
arrays.push_back(make_array(5, 5, 6));
std::for_each(arrays.begin(), arrays.end(), (_1[0])); //This line fails!
return 0;
}
エラーは次のとおりです。
error C2664: 'boost::lambda::detail::unspecified::unspecified(const boost::lambda::detail::unspecified &)' : cannot convert parameter 1 from 'int' to 'const boost::lambda::detail::unspecified &'
Reason: cannot convert from 'int' to 'const boost::lambda::detail::unspecified'
No constructor could take the source type, or constructor overload resolution was ambiguous
... ad infinitum...
このページを見つけました:返品型控除システムの拡張
しかし、うまく実装できませんでした。
ここで何ができるか知っている人はいますか?