
AMDG Sorry about responding to a digest. Gmane is down. Alexander Nasonov wrote:
How about this?
int BOOST_LOCAL_FUNCTION( (v) ) (int i) { return v = i; } BOOST_LOCAL_FUNCTION_END
<snip>
Nice way to handle the return type. You would need a base class and dynamic allocation right? Also, I need to be able to specify the name of the function somehow and I am not sure how this can be accomplished with that interface. Here's what I have right now: template<class Tuple, class F> struct local_function; #define BOOST_LOCAL_FUNCTION_DEF(z, n, data)\ template<class Tuple class R BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, class T)>\ struct local_function<Tuple, R(BOOST_PP_ENUM_PARAMS_Z(z, n, T))> {\ Tuple tuple;\ R (*f)(BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, T));\ local_function(const Tuple& t) : tuple(t) {}\ R operator()(BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z(z, n, T, t)) {\ return(f(tuple BOOST_PP_ENUM_SHIFTED_TRAILING_PARAMS_Z(z, n, t)))\ }\ }; BOOST_PP_REPEAT(BOOST_PP_INC(BOOST_LOCAL_FUNCTION_MAX_ARITY), BOOST_LOCAL_FUNCTION_DEF, ~) So that int BOOST_LOCAL_FUNCTION(name, (i)(j), (int x)(int y)) { //body here } BOOST_LOCAL_FUNCTION_END expands to int result_tag; typedef BOOST_TYPEOF(result_tag) result_type; typedef BOOST_TYPEOF(i) type_0; typedef BOOST_TYPEOF(j) type_1; typedef boost::tuple<type_0, type_1> tuple_type; typedef local_function<tuple_type, result_type(tuple_type, int x, int y)> function_type; function_type name(make_tuple(i, j)); { function_type* function_ptr = &name; struct body { result_type impl(tuple_type& args, int x, int y) { type_0& i = boost::get<0>(args); type_1 j = boost::get<1>(args); { //body here } } }; function_ptr->f = &body::impl; } Note that i and j are passed by value rather than by reference. Otherwise, it is not safe to have a copy of the function around after control leaves the scope it is defined in. In Christ, Steven Watanabe

Steven Watanabe <watanabesj <at> gmail.com> writes:
Also, I need to be able to specify the name of the function somehow and I am not sure how this can be accomplished with that interface. Here's what I have right now:
...
So that
int BOOST_LOCAL_FUNCTION(name, (i)(j), (int x)(int y)) { //body here } BOOST_LOCAL_FUNCTION_END
expands to
int result_tag; typedef BOOST_TYPEOF(result_tag) result_type; typedef BOOST_TYPEOF(i) type_0; typedef BOOST_TYPEOF(j) type_1; typedef boost::tuple<type_0, type_1> tuple_type; typedef local_function<tuple_type, result_type(tuple_type, int x, int y)> function_type; function_type name(make_tuple(i, j)); { function_type* function_ptr = &name; struct body { result_type impl(tuple_type& args, int x, int y) { type_0& i = boost::get<0>(args); type_1 j = boost::get<1>(args); { //body here } } }; function_ptr->f = &body::impl; }
This is really impressive! I'd moved function arguments closer to the function name int BOOST_LOCAL_FUNCTION(name, (int x)(int y), (i)(j) ) Ideally, arguments should be listed naturally: int BOOST_LOCAL_FUNCTION(name, (int x, int y), (i)(j) ) but I don't see how to pass the args variable to body::impl.
Note that i and j are passed by value rather than by reference. Otherwise, it is not safe to have a copy of the function around after control leaves the scope it is defined in.
Passing by reference is often fine for ScopeExit but it's very dangerous for local functions. Optionally passing by reference would be a nice feature, though. -- Alexander

On 8/21/07, Steven Watanabe <watanabesj@gmail.com> wrote:
So that
int BOOST_LOCAL_FUNCTION(name, (i)(j), (int x)(int y)) { //body here } BOOST_LOCAL_FUNCTION_END
expands to
int result_tag; typedef BOOST_TYPEOF(result_tag) result_type; typedef BOOST_TYPEOF(i) type_0; typedef BOOST_TYPEOF(j) type_1; typedef boost::tuple<type_0, type_1> tuple_type; typedef local_function<tuple_type, result_type(tuple_type, int x, int y)> function_type; function_type name(make_tuple(i, j)); { function_type* function_ptr = &name; struct body { result_type impl(tuple_type& args, int x, int y) { type_0& i = boost::get<0>(args); type_1 j = boost::get<1>(args); { //body here } } }; function_ptr->f = &body::impl; }
This requires that result_tag be default constructible. I think you want this instead: int *result_tag; typedef BOOST_TYPEOF(*result_tag) result_type; ... Zach Laine

Zach Laine <whatwasthataddress <at> gmail.com> writes:
int *result_tag; typedef BOOST_TYPEOF(*result_tag) result_type;
This won't work for reference types and void. int& *result_tag; ^^^ error: pointer to reference void *result_tag; typedef BOOST_TYPEOF(*result_tag) result_type; ^ error: dereference of void Function type if better: int& (*result_tag)() = 0; typedef result_of<BOOST_TYPEOF(result_tag)>::result_type result_type; -- Alexander

On 8/22/07, Alexander Nasonov <alnsn@yandex.ru> wrote:
Zach Laine <whatwasthataddress <at> gmail.com> writes:
int *result_tag; typedef BOOST_TYPEOF(*result_tag) result_type;
This won't work for reference types and void.
int& *result_tag; ^^^ error: pointer to reference
void *result_tag; typedef BOOST_TYPEOF(*result_tag) result_type; ^ error: dereference of void
Function type if better:
int& (*result_tag)() = 0; typedef result_of<BOOST_TYPEOF(result_tag)>::result_type result_type;
Good point. That's what I meant, of course. ;) Zach Laine

Alexander Nasonov <alnsn <at> yandex.ru> writes:
Function type if better:
int& (*result_tag)() = 0; typedef result_of<BOOST_TYPEOF(result_tag)>::result_type result_type;
Actually, this contruct has a limitation too. In some cases, typename is required: template<class T> void foo() { T& (*function_tag)() = 0; typedef typename remove_reference<BOOST_TYPEOF(function_tag)>::type sig; } -- Alexander

AMDG Alexander Nasonov <alnsn <at> yandex.ru> writes:
Actually, this contruct has a limitation too. In some cases, typename is required:
template<class T> void foo() { T& (*function_tag)() = 0; typedef typename remove_reference<BOOST_TYPEOF(function_tag)>::type sig; }
Can't you use the same mechanism that you use to avoid typename for the plain typeof? In Christ, Steven Watanabe

Hello and help. I would like to see what all the fuss is about, but I can't even get the simple "Hello World" sample program to build in my environment. I'm using boost_1_34_1 along with Visual Studio 2005. Down below are the errors that I get when I try. Either I'm not doing something right, or the BOOST_SCOPE_EXIT macro is not yet ready for prime-time. Normally, I'd try and solve these problems on my own, but I don't understand what's supposed to go on behind the scenes in order to make any intelligent changes here. Help please if you can. -Sid Sacek #include <iostream> #include <ostream> #include <string> #include <boost/scope_exit.hpp> #include <boost/typeof/std/string.hpp> int main() { try { std::string hello("Hello"), world("World"); BOOST_SCOPE_EXIT( (hello)(world) ) { std::clog << world << ", " << hello << "!\n"; } BOOST_SCOPE_EXIT_END std::cout << hello << ", " << world << "!\n"; // other code } catch(...) {} /* ^ "World, Hello\n" is printed at this point */ } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ------ Build started: Project: console2005, Configuration: Debug Win32 ------ Compiling... ScopeExit.cpp using typeof emulation g:\zzz this folder\boost_1_34_1\boost\typeof\encode_decode.hpp(47) : error C2504: '`anonymous-namespace'::boost_typeof::encode_type_impl<V,Type_Not_Registered _With_Typeof_System>' : base class undefined with [ V=boost::type_of::vector0<>, Type_Not_Registered_With_Typeof_System=boost::detail::scope_exit::wrapper<st d::string> ] g:\console2005\console2005\scopeexit.cpp(17) : see reference to class template instantiation 'boost::type_of::encode_type<V,T>' being compiled with [ V=boost::type_of::vector0<>, T=boost::detail::scope_exit::wrapper<std::string> ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type
::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item0' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item1' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item2' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item3' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item4' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item5' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item6' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item7' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item8' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item9' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item10' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item11' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item12' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item13' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item14' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item15' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item16' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item17' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item18' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item19' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item20' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item21' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item22' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item23' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item24' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item25' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item26' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item27' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item28' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item29' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item30' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item31' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'enable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::type ::type boost::type_of::encode(T &)' With the following template arguments: 'boost::type_of::vector0<>' 'boost::detail::scope_exit::wrapper<T>' with [ T=std::string ] g:\console2005\console2005\scopeexit.cpp(17) : error C2228: left of '.item32' must have class/struct/union g:\console2005\console2005\scopeexit.cpp(17) : error C2893: Failed to specialize function template 'disable_if<is_function<T>::type,boost::type_of::sizer<encode_type<V,T>::typ e>>::type boost::type_of::encode(const T &)' g:\console2005\console2005\scopeexit.cpp(17) : fatal error C1003: error count exceeds 100; stopping compilation Generating Code... Build log was saved at "file://g:\console2005\console2005\Debug\BuildLog.htm" console2005 - 102 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Sid Sacek <ssacek <at> appsecinc.com> writes:
Hello and help.
I would like to see what all the fuss is about, but I can't even get the simple "Hello World" sample program to build in my environment.
Other people reported typeof related problems on VC8. AFAIK, they have been fixed in HEAD branch. You can download it from this page http://engineering.meta-comm.com/boost.aspx -- Alexander

Steven Watanabe <steven <at> providere-consulting.com> writes:
Alexander Nasonov <alnsn <at> yandex.ru> writes:
Actually, this contruct has a limitation too. In some cases, typename is required: ...
Can't you use the same mechanism that you use to avoid typename for the plain typeof?
Sure, thanks for the hint. -- Alexander
participants (5)
-
Alexander Nasonov
-
Sid Sacek
-
Steven Watanabe
-
Steven Watanabe
-
Zach Laine