[Haskell-cafe] Interfacing C++ iterators does not work as expected

Gábor Lehel illissius at gmail.com
Mon May 2 22:51:09 CEST 2011


It works if I replace the 'bool' return type of 'finished' with int
and CInt on the C++ and Haskell side, respectively, and test for (/=
0).

On Mon, May 2, 2011 at 9:35 PM, Huynh Huu Long
<long.upcase at googlemail.com> wrote:
> Hi,
> I tried to access C++ iterators from Haskell via the FFI. There are two
> example programs attached, in Haskell as well as in C++. Both utilise the
> same iterator wrapper example.cpp, but when running the Haskell program it
> prints an empty list, where it should print the contents of some vector. The
> C++ program meanwhile runs fine though. What does not seem to work is this
> part:
> bool
> finished (std::vector<int>::iterator *begin, std::vector<int>::iterator
> *end)
> {
>     return *begin == *end;
> }
> In Haskellland, "finished :: Ptr Iterator -> Ptr Iterator -> IO Bool" always
> returns IO True. Is this a bug lurking in my program or is it a GHC issue?
> Long
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>



-- 
Work is punishment for failing to procrastinate effectively.



More information about the Haskell-Cafe mailing list