help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: map::data_type missing in gcc 4 ?


From: FÖLDY Lajos
Subject: Re: map::data_type missing in gcc 4 ?
Date: Thu, 6 Dec 2007 19:04:12 +0100


On Thu, 6 Dec 2007, vheinitz wrote:

Hello,
I am porting code which was compiling on gcc 3.2.2 to gcc 4
I am using (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux)
Looks like std::map hasn't typedef data_type whereas map::key_type is
still there.

SGI's implementation seems to provide map::data_type

Is there any other way to get data_type from std::map?

P.S.: Code I have to port has sth. like this:
template<typename T>
T::data_type GetSomeDataFromMap( T m )
{
  return m[0];
}


std::map::mapped_type

regards,
lajos


GCC 4.1.2 source code:

template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
          typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
    class map
    {
    public:
      typedef _Key                                key_type;
      typedef _Tp                                 mapped_type;
      typedef std::pair<const _Key, _Tp>          value_type;
      typedef _Compare                            key_compare;
      typedef _Alloc                              allocator_type;


SGI STL source code:

template <class _Key, class _Tp, class _Compare, class _Alloc>
class map {
public:

// requirements:

  __STL_CLASS_REQUIRES(_Tp, _Assignable);
  __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key);

// typedefs:

  typedef _Key                  key_type;
  typedef _Tp                   data_type;
  typedef _Tp                   mapped_type;
  typedef pair<const _Key, _Tp> value_type;
  typedef _Compare              key_compare;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]