v0.3.0
This commit is contained in:
parent
744c8c8f43
commit
b5eeb684b7
2 changed files with 2 additions and 4 deletions
|
@ -13,8 +13,6 @@ Branch | Linux/OSX | Windows | License | Codacy
|
|||
-------|-----------|---------|---------|-------
|
||||
master |[![Build Status](https://travis-ci.org/Neargye/nameof.svg?branch=master)](https://travis-ci.org/Neargye/nameof)|[![Build status](https://ci.appveyor.com/api/projects/status/yq5fk0d9mwljbubt/branch/master?svg=true)](https://ci.appveyor.com/project/Neargye/nameof/branch/master)|[![License](https://img.shields.io/github/license/Neargye/nameof.svg)](LICENSE)|[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1d06f3f07afe4f34acd29c0c8efa830b)](https://www.codacy.com/app/Neargye/nameof?utm_source=github.com&utm_medium=referral&utm_content=Neargye/nameof&utm_campaign=Badge_Grade)
|
||||
|
||||
C++ alternative to [nameof](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/nameof) operator in [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)).
|
||||
|
||||
Used to obtain the simple name of a variable, type, member, function, macros.
|
||||
Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// | |\ | (_| | | | | | | __/ (_) | | | |____|_| |_|
|
||||
// |_| \_|\__,_|_| |_| |_|\___|\___/|_| \_____|
|
||||
// https://github.com/Neargye/nameof
|
||||
// vesion 0.2.5
|
||||
// vesion 0.3.0
|
||||
//
|
||||
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
|
||||
// Copyright (c) 2016, 2018 Daniil Goncharov <neargye@gmail.com>.
|
||||
|
@ -43,7 +43,7 @@ inline constexpr bool IsLexeme(const char s) noexcept {
|
|||
|
||||
} // namespace detail
|
||||
|
||||
inline constexpr const char* Nameof(const char* name, const ::std::size_t length) noexcept {
|
||||
inline constexpr const char* Nameof(const char* name, const std::size_t length) noexcept {
|
||||
return ((length == 0) ? name : (detail::IsLexeme(name[length - 1])
|
||||
? &name[length]
|
||||
: Nameof(name, length - 1)));
|
||||
|
|
Loading…
Reference in a new issue