Skip to content

Commit 43bdbf5

Browse files
MapleMaple
authored andcommitted
constexpr optimization
1 parent 66cb867 commit 43bdbf5

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

include/BitfinexAPI.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ namespace BfxAPI
207207
const string& strResponse() const noexcept
208208
{ return result_ ; }
209209

210-
bool hasApiError() const noexcept
210+
bool hasApiError() const noexcept
211211
{
212212
if (bfxApiStatusCode_ == noError && curlStatusCode_ == CURLE_OK)
213213
return false;
@@ -216,15 +216,17 @@ namespace BfxAPI
216216
}
217217

218218
// Setters
219-
void setWDconfFilePath(const string &path) noexcept
219+
constexpr void setWDconfFilePath(const string &path) noexcept
220220
{ WDconfFilePath_ = path; }
221-
void setKeys(const string &accessKey, const string &secretKey) noexcept
221+
222+
constexpr void setKeys(const string &accessKey, const string &secretKey) noexcept
222223
{
223224
accessKey_ = accessKey;
224225
secretKey_ = secretKey;
225226
}
226-
string& setAccessKey() { return accessKey_;}
227-
string& setSecretKey() { return secretKey_;}
227+
228+
constexpr string& setAccessKey() { return accessKey_;}
229+
constexpr string& setSecretKey() { return secretKey_;}
228230

229231
////////////////////////////////////////////////////////////////////////
230232
// Public endpoints
@@ -1073,7 +1075,7 @@ namespace BfxAPI
10731075
// Utility private static methods
10741076
////////////////////////////////////////////////////////////////////////
10751077

1076-
static string bool2string(const bool &in) noexcept
1078+
const static string bool2string(const bool &in) noexcept
10771079
{ return in ? "true" : "false"; };
10781080

10791081
static string getTonce() noexcept

include/jsonutils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace jsonutils
7474
jsonStrToUsetHandler():state_(State::kExpectArrayStart) {}
7575

7676
// SAX events handlers
77-
bool StartArray()
77+
bool StartArray() noexcept
7878
{
7979
switch (state_)
8080
{
@@ -98,7 +98,7 @@ namespace jsonutils
9898
}
9999
}
100100

101-
bool EndArray(rj::SizeType)
101+
bool EndArray(rj::SizeType) noexcept
102102
{
103103
return state_ == State::kExpectValueOrArrayEnd;
104104
}

0 commit comments

Comments
 (0)