Boost logo

Boost :

From: Dirk Griffioen (d.griffioen_at_[hidden])
Date: 2003-09-24 10:08:23


Thanks!

The code compiles & links fine both with a Jamfile (vacpp-tools) and a
Makefile (my own defs.mak) on our AIX 433 with xlc 6 (the xlC_r variant)

The problem was - sorry & of course - something else (lexical_cast and not
utility):

//x.hpp
template<class T>
inline void DataType<T>::SetValue(const std::string& _value)
{
  value_ = boost::lexical_cast<T>(_value);
}

which in lexical_cast passes

            bool operator>>(InputStreamable &output)
            {
                return !is_pointer<InputStreamable>::value &&
                       stream >> output &&
                       (stream >> std::ws).eof();
            }

is_pointer (macro in is_pointer.hpp) in turn becomes:

template< typename T > struct is_pointer : mpl::bool_<
::boost::detail::is_pointer_impl<T>::value >

where in our code ::boost::detail::is_pointer_impl<T> evaluates to 0
because ???

(the linker has "ERROR: Undefined symbol: boost::mpl::bool_<0>::value")

######

If I add a specialization for int the linker still complains (std::string is
ok because of the different overload).

I do not understand - but this turns into a template/type_traits question;
anyway - thanks for your help! (

Dirk Griffioen

-----Original Message-----
From: Aleksey Gurtovoy [mailto:agurtovoy_at_[hidden]]
Sent: woensdag 24 september 2003 10:22
To: Boost mailing list
Subject: Re: [boost] my code -> utility -> type_traits -> mpl -> ERROR

my code -> utility -> type_traits -> mpl -> ERRORDirk Griffioen wrote:
> Hi all,
>
> why does boost/type_traits/detail/bool_trait_def.hpp include
> boost/mpl/bool.hpp ??

Because otherwise it would have to duplicate its content.

> which means I get a link ERROR: Undefined symbol:
> boost::mpl::bool_<0>::value

Which probably means your compiler is wrong.

> in code that seemingly nowhere includes anything near MPL (on
> AIX 433 with xlc6 and STLport), but merely mortal stuff like
> boost/shared_ptr or boost/utility.
>
> o, I forgot, utility passes type_traits passes, well, mpl.
>
> Yes I tried, utility_fwd where applicable and also outcommenting
> some stuff in utility.hpp and No I do think everything will work
> at once. But I do no understand why I have to suffer from this
> from my point of view uneccesary dependancy.

You are not suffering from a dependency, you are suffering from a compiler
bug. 'mpl::bool_<0>' or 'whatever<0>', you'd still get the same error.

> Can anyone please help? Or give me a pointer say
> "USE_THIS_HELPFULL_MACRO"?

Are you able to compile and link this one:

    template< bool C_ > struct bool_
    {
        static bool const value = C_;
    };

    template< bool C_ > bool const bool_<C_>::value;

    template< typename T > struct is_const : bool_<false> {};
    template< typename T > struct is_const<T const> : bool_<true> {};

    template< typename T, bool C_ = is_const<T>::value >
    struct something {};

    int main()
    {
        something<int> volatile s;
        return 0;
    }

?

> Thanks in advance..
>
> (MPL http://www.boost.org/libs/mpl/doc/index.html#details.depend
> mentions it depends ON the type_traits lib, and not the other
> way around, if both - isn't this circular?)

It is, and it isn't. It has nothing to do with your problem, though.

Aleksey
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk