Help me find a good typedef name for the following type

Discussion in 'C++' started by Eric Lilja, Mar 6, 2005.

  1. Eric Lilja

    Eric Lilja Guest

    Hello, got an odd question. I need a good typedef name for the type:
    std::vector<std::vector<std::pair<std::string, std::string> > >

    Even with using-statements to get rid of std:: it's simply too long and
    makes for keeping lines within a length of 80 columns cumbersome.

    I am using an object of that type to store matching rows (with a varying
    number of non-NULL columns) from an SQL database. The first string in the
    pair holds the field name and the second the field value.

    / Eric
     
    Eric Lilja, Mar 6, 2005
    #1
    1. Advertising

  2. Eric Lilja wrote:
    > Hello, got an odd question. I need a good typedef name
    > for the type:
    > std::vector<std::vector<std::pair<std::string,
    > std::string> > >
    >
    > Even with using-statements to get rid of std:: it's
    > simply too long and makes for keeping lines within a
    > length of 80 columns cumbersome.
    >
    > I am using an object of that type to store matching rows
    > (with a varying number of non-NULL columns) from an SQL
    > database. The first string in the pair holds the field
    > name and the second the field value.
    >
    > / Eric


    How about vvpss
     
    Martijn Mulder, Mar 6, 2005
    #2
    1. Advertising

  3. "Eric Lilja" <> writes:

    > Hello, got an odd question. I need a good typedef name for the type:
    > std::vector<std::vector<std::pair<std::string, std::string> > >
    >
    > Even with using-statements to get rid of std:: it's simply too long and
    > makes for keeping lines within a length of 80 columns cumbersome.
    >
    > I am using an object of that type to store matching rows (with a varying
    > number of non-NULL columns) from an SQL database. The first string in the
    > pair holds the field name and the second the field value.
    >
    > / Eric
    >


    typedef std::pair<std::string, std::string> column_value_t;
    typedef std::vector<column_value_t> record_t;
    typedef std::vector<record_t> table_t;

    --
    Mikhail Polatov
    MetaCommunications Engineering
     
    Mikhail Polatov, Mar 6, 2005
    #3
  4. * Eric Lilja:
    > Hello, got an odd question. I need a good typedef name for the type:
    > std::vector<std::vector<std::pair<std::string, std::string> > >
    >
    > Even with using-statements to get rid of std:: it's simply too long and
    > makes for keeping lines within a length of 80 columns cumbersome.
    >
    > I am using an object of that type to store matching rows (with a varying
    > number of non-NULL columns) from an SQL database. The first string in the
    > pair holds the field name and the second the field value.


    Possibly you'd be better off by representing the NULL columns explicitly,
    and store the field names just once, in a separate vector.

    However,

    typedef std::pair<std::string, std::string> NameValuePair;
    typedef std::vector<NameValuePair> DbResultRow;
    typedef std::vector<DbResultRow> DbResultTable;
    typedef DbResultTable DbView;


    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, Mar 6, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M. Faust
    Replies:
    0
    Views:
    392
    M. Faust
    Oct 18, 2004
  2. Sergei Gnezdov

    type* name vs. type *name

    Sergei Gnezdov, Mar 29, 2005, in forum: C Programming
    Replies:
    5
    Views:
    290
    Gordon Burditt
    Mar 29, 2005
  3. Eric Lilja

    Print name of typedef:ed type

    Eric Lilja, Nov 14, 2007, in forum: C++
    Replies:
    8
    Views:
    450
    Joel Yliluoma
    Nov 23, 2007
  4. Replies:
    1
    Views:
    2,321
  5. oor
    Replies:
    0
    Views:
    1,356
Loading...

Share This Page