From b5eeb684b750196baae8c9e24468f446dd3cec5b Mon Sep 17 00:00:00 2001 From: Neargye Date: Tue, 29 May 2018 20:51:18 +0500 Subject: [PATCH] v0.3.0 --- README.md | 2 -- include/nameof.hpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d8070a6..3501beb 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/include/nameof.hpp b/include/nameof.hpp index 6338bcb..3d47bcf 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -5,7 +5,7 @@ // | |\ | (_| | | | | | | __/ (_) | | | |____|_| |_| // |_| \_|\__,_|_| |_| |_|\___|\___/|_| \_____| // https://github.com/Neargye/nameof -// vesion 0.2.5 +// vesion 0.3.0 // // Licensed under the MIT License . // Copyright (c) 2016, 2018 Daniil Goncharov . @@ -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)));