Hi, since I've read in the documentation "Boost.Python is known to have been tested in the following configurations: Against Python 2.0 using the following compiler/library combinations: MSVC++6sp4 with the native library. ... Against Python 1.5.2 using the following compiler/library: MSVC++6sp4 MSVC++6sp4/STLport 4.0" and since I am using the MSVC++6sp4/STLport 4.0 combination I deinstalled Python 2.2 (for which the build failed) and installed Python 1.5.2. Running G:\Environment\boost_1_27_0>jam -sBOOST_ROOT=. -sTOOLS="msvc-stlport" I get the following errors: don't know how to make <python-library@>python21.lib ...patience... ...patience... ...found 2247 targets... ...using 2 temp targets... ...updating 132 targets... ...can't find 1 target... ...can't make 42 targets... msvc-C++-action libs\python\build\bin\libboost_python_static\msvc-stlport\debug\ runtime-link-dynamic\stlport-iostream-off\stlport-version-4.0\types.obj types.cpp .\boost/python/detail/wrap_python.hpp(24) : fatal error C1083: Include-Datei kann nicht geoeffnet werden: 'patchlevel.h': No such file or directory cl /Zm400 -nologo -GX -c -DBOOST_PYTHON_STATIC_LIB=1 -DBOOST_PYTHON_DYNAMI C_LIB -D__STL_NO_SGI_IOSTREAMS=1 -D__STL_DEBUG=1 -D__STL_DEBUG_UNINITIALIZED=1 /Zi /Od /Ob0 /GX /GR /MDd -I"libs\python\build" -I"." -I"c:/tools/python\inclu de" -I"c:/tools/python\PC" -I"\stlport" -I"D:\PROGRA~1\MICROS~1.0\VC98\include" -Fo"libs\python\build\bin\libboost_python_static\msvc-stlport\debug\runtime-li nk-dynamic\stlport-iostream-off\stlport-version-4.0\types.obj" -Tp"libs\python\ build\../src\types.cpp" ...failed msvc-C++-action libs\python\build\bin\libboost_python_static\msvc-stlp ort\debug\runtime-link-dynamic\stlport-iostream-off\stlport-version-4.0\types.ob j ... msvc-C++-action libs\python\build\bin\libboost_python_static\msvc-stlport\debug\ runtime-link-dynamic\stlport-iostream-off\stlport-version-4.0\classes.obj classes.cpp .\boost/python/detail/wrap_python.hpp(24) : fatal error C1083: Include-Datei kan n nicht geoeffnet werden: 'patchlevel.h': No such file or directory ............ [The obvious translation of this error message is: Cannot open include file 'patchlevel.h'.] What am I doing wrong? By the way, all of the other libs including tests are compiling with Jam without any problems at all. And, as a second quesion, why is there no MSVC++6sp4/STLport 4.0 support for the newer Python versions - by the way, there is already a Python v2.2. Thanks for any hints and help Ali *
"Albrecht Fritzsche" <albrecht.fritzsche@tiscali-dsl.de> wrote in message news:3CCE3E14.5060909@tiscali-dsl.de...
Hi,
since I've read in the documentation
"Boost.Python is known to have been tested in the following configurations: Against Python 2.0 using the following compiler/library combinations: MSVC++6sp4 with the native library. ... Against Python 1.5.2 using the following compiler/library: MSVC++6sp4 MSVC++6sp4/STLport 4.0"
and since I am using the MSVC++6sp4/STLport 4.0 combination I deinstalled Python 2.2 (for which the build failed) and installed Python 1.5.2.
1. Get the latest CVS state. Release 1.27 is broken in several ways. 2. Look at the current state of compiler interoperability at libs/python/doc/index.html, or online at http://makeashorterlink.com/?R52A12AC
What am I doing wrong? By the way, all of the other libs including tests are compiling with Jam without any problems at all.
Part of it has to do with configuring Python. The latest CVS state will give you instructions when you try to build if you're badly misconfigured.
And, as a second quesion, why is there no MSVC++6sp4/STLport 4.0 support for the newer Python versions - by the way, there is already a Python v2.2.
The library works with Python 2.2.1 -Dave
I want to define operator * for a point type P. template <class T> class TPoint<T> { ... template <class U> TPoint<U> operator *(U t) const; ... }; template <class T> template <class U> TPoint<U> TPoint<T>::operator *(U t) const { return TPoint<U>((U)x()/t, (U)y()/t); } but I only want to define this for types for which boost::is_arithmetic<U> is true. This is because I also want to define operator * for an affine transformation template <class PT, class AT> inline Geomt::TPoint<AT> operator * (const Geomt::TPoint<PT>& pt, const AffHen<AT>& sAH) { Geomt::TPoint<AT> pout; sAH.Pt(pt.x, pt.y, pout.x, pout.y); return pout; } and this sometimes conflicts with the first definition. At the point of the first definition, type AffHen is unknown, so I can't branch there then using type traits. What I want to do is leave all argument types apart from arithmentic types undefined, to be available for later use. Is there a well known way to do this apart from making the affine transform the first argument? I wonder if boost type traits can help here. I know how to use type traits to enable compile time seperate procedures, but not how to use it to define a procedure for some type and not others. Craig Hicks
I know how to use type traits to enable compile time seperate procedures, but not how to use it to define a procedure for some type and not others.
One way (for member functions) is to use inheritance: add an "implementation layer" that includes the member function or not depending on whether a trait is true or not: template <class T, bool b> struct mybase { // details T operator*(); }; template <class T, true> struct mybase { // details }; template <class T> struct mine : public mybase<T, ::boost::is_arithmetic<T>::value> { // details };
On Friday 03 May 2002 13:58, John Maddock wrote:
I know how to use type traits to enable compile time seperate procedures, but not how to use it to define a procedure for some type and not others.
check out http://groups.yahoo.com/group/Boost-Users/message/741 from Aleksey in teaching me how to combine MPL with the type_traits. BTW, the article of Andrei really helps (I had read it before but finally understood it really trying it muself) t
Hi Toon Thanks for the lead:: http://www.cuj.com/experts/1810/alexandr.htm I checked it out. Alex wrote about 3 solutions for the problem 1. Specialize on meber function argument type (e.g., add IntToType<is_arithmetic<T> > as a parameter type) 2. Create external template helper class with specialization, and call that from member function. 3. Create internal template helper class. The article conclused that 1 was usually best. But in the case of an operator function (operator::*) the number of arguments are pre-defined, so that is not an immediate option, although functions to be called from inside the body of operator*() could be added. As it happens I have already coded solution 2, so I think I'll stick with that (also saves clutter inside struture definition). Code is in last message I posted to this list. Cheers Craig Hicks Toon Knapen wrote:
On Friday 03 May 2002 13:58, John Maddock wrote:
I know how to use type traits to enable compile time seperate procedures, but not how to use it to define a procedure for some type and not others.
check out http://groups.yahoo.com/group/Boost-Users/message/741
from Aleksey in teaching me how to combine MPL with the type_traits. BTW, the article of Andrei really helps (I had read it before but finally understood it really trying it muself)
t
Info: <http://www.boost.org> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> Unsubscribe: <mailto:boost-users-unsubscribe@yahoogroups.com>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
[Non-text portions of this message have been removed]
Thanks. Code is below. Member operator *() branches to a template functor which specializes for arithmetic type, and leaves the rest undefined. Later, the operator * still cannot be overloaded, but the as yet undefined cases of the template functor are available to be defined. So that is how the problem is solved. I didn't want to use inheritance as that could profoundly affect performance. (In the atual code, A is a point type and Z is an affine transformation type. I want to be able to write a * z0 * z1 * z3, etc.Otherwise I have to define Z * A and write z3 * (z2 * (z1*a))) to bring about the same computation.) [I also wanted to key the return type using type traits, but the compiler complained about invalid template argument list, but that's another story]. Craig Hicks John Maddock wrote:
I know how to use type traits to enable compile time seperate procedures, but not how to use it to define a procedure for some type and not others.
One way (for member functions) is to use inheritance: add an "implementation layer" that includes the member function or not depending on whether a trait is true or not:
template <class T, bool b> struct mybase { // details T operator*(); };
template <class T, true> struct mybase { // details };
template <class T> struct mine : public mybase<T, ::boost::is_arithmetic<T>::value> { // details };
Info: <http://www.boost.org> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> Unsubscribe: <mailto:boost-users-unsubscribe@yahoogroups.com>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
#include <iostream> #include "boost\type_traits.hpp" /////////////////////////////////////////////////////////////////// template <class T> struct A { T i; template <class U> A<T> operator * (const U& u) const; }; template <class T, class U, bool b> struct AMultFtr { A<T> operator()(const A<T>& a, const U& u) const; }; template <class T, class U> struct AMultFtr<T, U, true> { A<T> operator()(const A<T>& a, const U& u) const { A<T> ra; ra.i = a.i * u; return ra;} }; template <class T> template <class U> A<T> A<T>::operator * (const U& u) const { // A<U> a; // a.i = i * u; // return a; return AMultFtr<T, U, boost::is_arithmetic<U>::value>()(*this,u); }; /////////////////////////////////////////////////////////////////// struct Z { float x,y; }; #if (0) template <class T> A<float> operator * (const A<T>& a, const Z& z) { A<float> ra; ra.i= a.i * z.x + z.y; return ra; } #else template <class T> struct AMultFtr<T, Z, false> { A<T> operator()(const A<T>& a, const Z& z) const { A<T> ra; ra.i= a.i * z.x + z.y; return ra; } }; #endif /////////////////////////////////////////////////////////////////// //--------------------------------------------------------------------------- #pragma argsused int main(int argc, char* argv[]) { A<int> a; a.i = 1; std::cout << (a*3.5).i << std::endl; Z z; z.x = 4.5; z.y = 5.5; std::cout << (a*z).i << std::endl; return 0; } //---------------------------------------------------------------------------
participants (5)
-
Albrecht Fritzsche
-
David Abrahams
-
hicks
-
John Maddock
-
Toon Knapen