Alias for STL object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Xx r3negade
    New Member
    • Apr 2008
    • 39

    Alias for STL object

    I'm designing a program that frequently deals with coordinate pairs. I've decided to use stl::pair for this purpose. As these are all coordinate pairs, they will all be of type pair<int, int>. My question is, rather than declaring pair<int, int> each time, like seen here:
    Code:
    pair<int, int> foo;
    void bar(pair<int, int>* biz) {
    return;
    }
    can I create some kind of alias that would allow me to do this:
    Code:
    intpair foo;
    void bar(intpair* biz) {
    return;
    }
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Code:
    typedef std::pair<int, int> intpair;
    might work.

    Comment

    • Laharl
      Recognized Expert Contributor
      • Sep 2007
      • 849

      #3
      It does work, I just tested it.

      Comment

      Working...