Changeset 1b6477e in mainline
- Timestamp:
- 2018-07-05T21:41:17Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef9d0988
- Parents:
- c2c1966
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-10-11 16:29:33)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:17)
- Location:
- uspace/lib/cpp
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/Makefile
rc2c1966 r1b6477e 41 41 src/exception.cpp \ 42 42 src/new.cpp \ 43 src/typeinfo.cpp 43 src/typeinfo.cpp \ 44 src/internal/runtime.cpp 44 45 45 46 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/cpp/include/typeinfo
rc2c1966 r1b6477e 27 27 */ 28 28 29 #include <cstdlib> 30 29 31 namespace std 30 32 { -
uspace/lib/cpp/src/typeinfo.cpp
rc2c1966 r1b6477e 28 28 29 29 #include <cstring> 30 31 30 #include <typeinfo> 32 31 … … 50 49 bool type_info::before(const type_info& other) const noexcept 51 50 { 52 // TODO: implement (need type_index) 53 return false; 51 /** 52 * cppreference.com: 53 * Returns true if the type of this type_info precedes the type 54 * of rhs in the implementation's collation order. No guarantees 55 * are given; in particular, the collation order can change 56 * between the invocations of the same program. 57 * 58 * Seems completely arbitrary and the only guarantee 59 * we have to provide that two comparisons of two same 60 * type_info instances return the same result. 61 */ 62 return name() < other.name(); 54 63 } 55 64 56 65 size_t type_info::hash_code() const noexcept 57 66 { 58 // TODO: implement 59 return size_t{}; 67 /** 68 * We only need for the hash codes of two type_info 69 * instances describing the same type to match, nothing 70 * else. 71 */ 72 size_t res{}; 73 const char* str = name(); 74 while(*str) 75 res += static_cast<size_t>(*str++); 76 77 return res; 60 78 } 61 79
Note:
See TracChangeset
for help on using the changeset viewer.