Skip to content

Commit

Permalink
Fix conflicts with boost placeholders (#18)
Browse files Browse the repository at this point in the history
Remove using namespace in methods.h header.
The user should get to select the namespace for _1, _2, ...
  • Loading branch information
snoe925 authored Oct 24, 2019
1 parent 45424b8 commit f547585
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 38 deletions.
38 changes: 18 additions & 20 deletions cpptcl/details/methods.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

// Note: this file is not supposed to be a stand-alone header

using namespace std::placeholders;

template <class C, typename R> class method0 : public object_cmd_base {
typedef R (C::*mem_type)();
typedef R (C::*cmem_type)() const;
Expand Down Expand Up @@ -49,9 +47,9 @@ template <class C, typename R, typename T1> class method1 : public object_cmd_ba

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1>(interp, std::bind(cf_, p, _1), tcl_cast<T1>::from(interp, objv[2], byRef.value));
dispatch<R>::template do_dispatch<T1>(interp, std::bind(cf_, p, std::placeholders::_1), tcl_cast<T1>::from(interp, objv[2], byRef.value));
} else {
dispatch<R>::template do_dispatch<T1>(interp, std::bind(f_, p, _1), tcl_cast<T1>::from(interp, objv[2], byRef.value));
dispatch<R>::template do_dispatch<T1>(interp, std::bind(f_, p, std::placeholders::_1), tcl_cast<T1>::from(interp, objv[2], byRef.value));
}
}

Expand All @@ -76,9 +74,9 @@ template <class C, typename R, typename T1, typename T2> class method2 : public

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2>(interp, std::bind(cf_, p, _1, _2), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value));
dispatch<R>::template do_dispatch<T1, T2>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value));
} else {
dispatch<R>::template do_dispatch<T1, T2>(interp, std::bind(f_, p, _1, _2), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value));
dispatch<R>::template do_dispatch<T1, T2>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value));
}
}

Expand All @@ -104,9 +102,9 @@ template <class C, typename R, typename T1, typename T2, typename T3> class meth

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2, T3>(interp, std::bind(cf_, p, _1, _2, _3), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value));
dispatch<R>::template do_dispatch<T1, T2, T3>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value));
} else {
dispatch<R>::template do_dispatch<T1, T2, T3>(interp, std::bind(f_, p, _1, _2, _3), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value));
dispatch<R>::template do_dispatch<T1, T2, T3>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value));
}
}

Expand All @@ -133,9 +131,9 @@ template <class C, typename R, typename T1, typename T2, typename T3, typename T

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2, T3, T4>(interp, std::bind(cf_, p, _1, _2, _3, _4), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value));
} else {
dispatch<R>::template do_dispatch<T1, T2, T3, T4>(interp, std::bind(f_, p, _1, _2, _3, _4), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value));
}
}

Expand Down Expand Up @@ -163,9 +161,9 @@ template <class C, typename R, typename T1, typename T2, typename T3, typename T

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5>(interp, std::bind(cf_, p, _1, _2, _3, _4, _5), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value));
} else {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5>(interp, std::bind(f_, p, _1, _2, _3, _4, _5), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value));
}
}

Expand Down Expand Up @@ -194,9 +192,9 @@ template <class C, typename R, typename T1, typename T2, typename T3, typename T

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6>(interp, std::bind(cf_, p, _1, _2, _3, _4, _5, _6), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value));
} else {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6>(interp, std::bind(f_, p, _1, _2, _3, _4, _5, _6), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value));
}
}

Expand Down Expand Up @@ -226,9 +224,9 @@ template <class C, typename R, typename T1, typename T2, typename T3, typename T

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7>(interp, std::bind(cf_, p, _1, _2, _3, _4, _5, _6, _7), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value));
} else {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7>(interp, std::bind(f_, p, _1, _2, _3, _4, _5, _6, _7), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value));
}
}

Expand Down Expand Up @@ -259,9 +257,9 @@ template <class C, typename R, typename T1, typename T2, typename T3, typename T

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8>(interp, std::bind(cf_, p, _1, _2, _3, _4, _5, _6, _7, _8), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7, std::placeholders::_8), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value));
} else {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8>(interp, std::bind(f_, p, _1, _2, _3, _4, _5, _6, _7, _8), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7, std::placeholders::_8), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value));
}
}

Expand Down Expand Up @@ -293,9 +291,9 @@ template <class C, typename R, typename T1, typename T2, typename T3, typename T

C *p = static_cast<C *>(pv);
if (cmem_) {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8, T9>(interp, std::bind(cf_, p, _1, _2, _3, _4, _5, _6, _7, _8, _9), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value), tcl_cast<T9>::from(interp, objv[10], byRef9.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8, T9>(interp, std::bind(cf_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7, std::placeholders::_8, std::placeholders::_9), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value), tcl_cast<T9>::from(interp, objv[10], byRef9.value));
} else {
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8, T9>(interp, std::bind(f_, p, _1, _2, _3, _4, _5, _6, _7, _8, _9), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value), tcl_cast<T9>::from(interp, objv[10], byRef9.value));
dispatch<R>::template do_dispatch<T1, T2, T3, T4, T5, T6, T7, T8, T9>(interp, std::bind(f_, p, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6, std::placeholders::_7, std::placeholders::_8, std::placeholders::_9), tcl_cast<T1>::from(interp, objv[2], byRef1.value), tcl_cast<T2>::from(interp, objv[3], byRef2.value), tcl_cast<T3>::from(interp, objv[4], byRef3.value), tcl_cast<T4>::from(interp, objv[5], byRef4.value), tcl_cast<T5>::from(interp, objv[6], byRef5.value), tcl_cast<T6>::from(interp, objv[7], byRef6.value), tcl_cast<T7>::from(interp, objv[8], byRef7.value), tcl_cast<T8>::from(interp, objv[9], byRef8.value), tcl_cast<T9>::from(interp, objv[10], byRef9.value));
}
}

Expand Down
Loading

0 comments on commit f547585

Please sign in to comment.