# HG changeset patch
# User Balazs Dezso <deba@inf.elte.hu>
# Date 1266185579 -3600
# Node ID 91d50cfe924edb1127d189701876259a859c481a
# Parent  268a052c3043a8f34f194ae27ab9e425f145ff8b# Parent  5100072d83caa82eaf0be1a84a27e5d1917f2efd
Merge bugfix #337 to branch 1.1

diff -r 268a052c3043 -r 91d50cfe924e lemon/glpk.h
--- a/lemon/glpk.h	Thu Dec 10 09:14:47 2009 +0100
+++ b/lemon/glpk.h	Sun Feb 14 23:12:59 2010 +0100
@@ -25,16 +25,28 @@
 
 #include <lemon/lp_base.h>
 
-// forward declaration
-#if !defined _GLP_PROB && !defined GLP_PROB
-#define _GLP_PROB
-#define GLP_PROB
-typedef struct { double _opaque_prob; } glp_prob;
-/* LP/MIP problem object */
-#endif
-
 namespace lemon {
 
+  namespace _solver_bits {
+    class VoidPtr {
+    private:
+      void *_ptr;      
+    public:
+      VoidPtr() : _ptr(0) {}
+
+      template <typename T>
+      VoidPtr(T* ptr) : _ptr(reinterpret_cast<void*>(ptr)) {}
+
+      template <typename T>
+      VoidPtr& operator=(T* ptr) { 
+        _ptr = reinterpret_cast<void*>(ptr); 
+        return *this;
+      }
+
+      template <typename T>
+      operator T*() const { return reinterpret_cast<T*>(_ptr); }
+    };
+  }
 
   /// \brief Base interface for the GLPK LP and MIP solver
   ///
@@ -43,8 +55,7 @@
   class GlpkBase : virtual public LpBase {
   protected:
 
-    typedef glp_prob LPX;
-    glp_prob* lp;
+    _solver_bits::VoidPtr lp;
 
     GlpkBase();
     GlpkBase(const GlpkBase&);
@@ -122,9 +133,9 @@
   public:
 
     ///Pointer to the underlying GLPK data structure.
-    LPX *lpx() {return lp;}
+    _solver_bits::VoidPtr lpx() {return lp;}
     ///Const pointer to the underlying GLPK data structure.
-    const LPX *lpx() const {return lp;}
+    _solver_bits::VoidPtr lpx() const {return lp;}
 
     ///Returns the constraint identifier understood by GLPK.
     int lpxRow(Row r) const { return rows(id(r)); }