[Insight-developers] select1st is not portable - I need some help, please (Solaris, CC)
Attila Nagy
nagy.attila at yahoo.com
Tue Mar 30 03:34:40 EDT 2010
Hi Luis,
no, it was me who missed something (C++ skills, maybe? :)). I thought it would be more complicated than this.
Works now! :)
Thanks,
Attila
--- On Mon, 3/29/10, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> From: Luis Ibanez <luis.ibanez at kitware.com>
> Subject: Re: [Insight-developers] select1st is not portable - I need some help, please (Solaris, CC)
> To: "Attila Nagy" <nagy.attila at yahoo.com>
> Cc: "Itk list" <insight-developers at itk.org>, stefan.teleman at gmail.com, "Steve Pieper" <pieper at bwh.harvard.edu>
> Date: Monday, March 29, 2010, 11:51 PM
> Hi Attila,
>
> I may be missing something...
>
> but it looks like you simply need to add the "const"
> version of that operator.
>
>
> That is, you should have
>
> typename PairT::first_type
> operator()(const PairT& a) const {
> return a.first; }
>
> in addition to your current
>
> typename PairT::first_type
> operator()(const PairT& a) { return a.first; }
>
>
>
> Regards,
>
>
> Luis
>
>
>
> --------------------------------------------------------------------------
> On Mon, Mar 29, 2010 at 5:34 AM, Attila Nagy <nagy.attila at yahoo.com>
> wrote:
> > Hi all,
> >
> > to put a long story short, in recent OpensSolaris
> builds, Su^H^H Oracle has incorporated Apache's stdlib
> implementation into the OS itself (it is included in
> /usr/lib, whereas stlport, for example, is distributed with
> the compiler collection), and I am trying to build Slicer's
> toolchain, and Slicer itself with this lib. There are
> various reasons for it (one being this: http://www.itk.org/mailman/private/insight-developers/2009-August/013223.html
> , I'll fire up a wiki page on this a bit later, if anyone is
> interested.)
> > Now to the problem:
> > I learned over the past weekend, that hash_map is not
> portable, it has never been part of any C++ standard. It
> happens to be accepted by the GNU community, and even Sun's
> Cstd and stlport implementation happen to contain this
> header, that comes from SGI's implentation. On the other
> hand Apache's strict implementation does not contain this.
> Hence I get build errors, with Studio12.1 (CC5.10) (Slicer
> uses ITK 3-16 at the moment)
> >
> >
> "/ufsbckp/head-64-slicer/apache/Slicer3-lib/Insight/Code/Common/itk_hash_map.h",
> line 134: Error: select1st is not a member of std.
> >
> > and then a bunch of other errors/warnings because of
> this.
> >
> > By inserting the following code into itk_hash_map.h (I
> found it here:
> > http://stackoverflow.com/questions/2504562/is-it-safe-to-define-has-traditional-stl-to-enable-stl-functionality
> )
> >
> > template <typename PairT>
> > struct select1st : public
> std::unary_function<PairT, typename
> PairT::first_type>
> > {
> > typename PairT::first_type operator()(const
> PairT& a) { return a.first; }
> > };
> >
> > this compiles fine (even without a warning, and with
> gcc too).
> >
> > But a bit later I get:
> >
> >
> "/ufsbckp/head-64-slicer/apache/Slicer3-lib/Insight/Code/Common/itk_hashtable.h",
> line 569: Error: Non-const function
> select1st<std::pair<const unsigned long, unsigned
> long>>::operator()(const std::pair<const unsigned
> long, unsigned long>&) called for const object.
> >
> "/ufsbckp/head-64-slicer/apache/Slicer3-lib/Insight/Code/Common/itk_hash_map.h",
> line 211: Where: While instantiating
> "itk::hashtable<std::pair<const unsigned long,
> unsigned long>, unsigned long, itk::hash<unsigned
> long>, select1st<std::pair<const unsigned long,
> unsigned long>>, std::equal_to<unsigned long>,
> std::allocator<char>>::find(const unsigned
> long&) const".
> >
> "/ufsbckp/head-64-slicer/apache/Slicer3-lib/Insight/Code/Common/itk_hash_map.h",
> line 211: Where: Instantiated from
> itk::hash_map<unsigned long, unsigned long,
> itk::hash<unsigned long>, std::equal_to<unsigned
> long>, std::allocator<char>>::find(const
> unsigned long&) const.
> >
> "/ufsbckp/head-64-slicer/apache/Slicer3-lib/Insight/Code/Common/itkEquivalencyTable.cxx",
> line 106: Where: Instantiated from non-template code.
> > 1 Error(s) detected.
> >
> > ...and I'm at loss here.
> > Could somebody please take a look at it?
> >
> > Thanks very much,
> > Attila
> >
> > ps: VTK compiles fine (a few files needed the
> <ios> header), by the way, and this is so far the only
> error in ITK with Apache stdlib.
> >
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more
> information visit:
> > http://kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ
> at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-developers
> >
>
More information about the Insight-developers
mailing list