1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (C) 2003-2011, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
14 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UStack)
16 UStack::UStack(UErrorCode &status) :
21 UStack::UStack(int32_t initialCapacity, UErrorCode &status) :
22 UVector(initialCapacity, status)
26 UStack::UStack(UObjectDeleter *d, UElementsAreEqual *c, UErrorCode &status) :
31 UStack::UStack(UObjectDeleter *d, UElementsAreEqual *c, int32_t initialCapacity, UErrorCode &status) :
32 UVector(d, c, initialCapacity, status)
38 void* UStack::pop(void) {
39 int32_t n = size() - 1;
42 result = elementAt(n);
48 int32_t UStack::popi(void) {
49 int32_t n = size() - 1;
52 result = elementAti(n);
58 int32_t UStack::search(void* obj) const {
59 int32_t i = indexOf(obj);
60 return (i >= 0) ? size() - i : i;