Skip to content

Commit

Permalink
remove special code to support C++11
Browse files Browse the repository at this point in the history
Don't use the macros
- BOOST_NO_DELETED_FUNCTIONS
- BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
- BOOST_NO_VARIADIC_TEMPLATES
anymore because all compiler support those features now
(https://en.cppreference.com/w/cpp/compiler_support/11).
  • Loading branch information
ursfassler committed Dec 28, 2023
1 parent 306a647 commit f5e5a1b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 41 deletions.
8 changes: 1 addition & 7 deletions include/cucumber-cpp/internal/hook/HookRegistrar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
#include "../Scenario.hpp"
#include "../step/StepManager.hpp"

#include <boost/config.hpp>
#include <memory>

#include <list>

namespace cucumber {
Expand Down Expand Up @@ -102,11 +100,7 @@ class CUCUMBER_CPP_EXPORT HookRegistrar {

private:
// We're a singleton so don't allow instances
HookRegistrar()
#ifndef BOOST_NO_DELETED_FUNCTIONS
= delete
#endif
;
HookRegistrar() = delete;
};

class CUCUMBER_CPP_EXPORT StepCallChain {
Expand Down
26 changes: 3 additions & 23 deletions include/cucumber-cpp/internal/step/StepManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@
#include <stdexcept>
#include <string>
#include <vector>

#include <boost/config.hpp>
#include <memory>

#ifndef BOOST_NO_VARIADIC_TEMPLATES
#include <type_traits>
#endif
#include <type_traits>

#include <cucumber-cpp/internal/CukeExport.hpp>
#include "../Table.hpp"
Expand Down Expand Up @@ -43,10 +38,7 @@ class CUCUMBER_CPP_EXPORT MatchResult {
const match_results_type& getResultSet();
void addMatch(SingleStepMatch match);

#ifndef BOOST_NO_EXPLICIT_CONVERSION_OPERATORS
explicit
#endif
operator bool() const;
explicit operator bool() const;

private:
match_results_type resultSet;
Expand Down Expand Up @@ -139,13 +131,6 @@ class CUCUMBER_CPP_EXPORT BasicStep {
const T getInvokeArg();
const InvokeArgs* getArgs();

#ifdef BOOST_NO_VARIADIC_TEMPLATES
// Special case for zero arguments, only thing we bother to support on C++98
template<typename Derived, typename R>
static R invokeWithArgs(Derived& that, R (Derived::*f)()) {
return (that.*f)();
}
#else
template<typename Derived, typename R, typename... Args, std::size_t... N>
static R invokeWithIndexedArgs(Derived& that, R (Derived::*f)(Args...), index_sequence<N...>) {
return (that.*f)(that.pArgs->template getInvokeArg<typename std::decay<Args>::type>(N)...);
Expand All @@ -156,7 +141,6 @@ class CUCUMBER_CPP_EXPORT BasicStep {
that.currentArgIndex = sizeof...(Args);
return invokeWithIndexedArgs(that, f, index_sequence_for<Args...>{});
}
#endif

private:
// FIXME: awful hack because of Boost::Test
Expand Down Expand Up @@ -188,11 +172,7 @@ class CUCUMBER_CPP_EXPORT StepManager {

private:
// We're a singleton so don't allow instances
StepManager()
#ifndef BOOST_NO_DELETED_FUNCTIONS
= delete
#endif
;
StepManager() = delete;
};

static inline std::string toSourceString(const char* filePath, const int line) {
Expand Down
8 changes: 1 addition & 7 deletions include/cucumber-cpp/internal/utils/IndexSequence.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#ifndef CUKE_INDEXSEQ_HPP_
#define CUKE_INDEXSEQ_HPP_

#include <boost/config.hpp>

#ifndef BOOST_NO_VARIADIC_TEMPLATES

#include <utility>
#include <utility>

namespace cucumber {
namespace internal {
Expand All @@ -16,6 +12,4 @@ using ::std::index_sequence_for;
}
}

#endif /* !BOOST_NO_VARIADIC_TEMPLATES */

#endif /* CUKE_INDEXSEQ_HPP_ */
4 changes: 0 additions & 4 deletions tests/unit/CukeCommandsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <cucumber-cpp/internal/step/StepMacros.hpp>
#include "utils/CukeCommandsFixture.hpp"

#include <boost/config.hpp>

using namespace cucumber::internal;

using std::string;
Expand Down Expand Up @@ -77,7 +75,6 @@ class CheckAllParametersWithMacro : public CheckAllParameters {
}
};

#ifndef BOOST_NO_VARIADIC_TEMPLATES
class CheckAllParametersWithFuncArgs : public CheckAllParameters {
public:
void bodyWithArgs(
Expand All @@ -101,7 +98,6 @@ TEST_F(CukeCommandsTest, invokeHandlesParametersWithFuncArgs) {
// The real test is in TestClass::body()
runStepBodyTest<CheckAllParametersWithFuncArgs>();
}
#endif

TEST_F(CukeCommandsTest, matchesCorrectly) {
addStepWithMatcher(STATIC_MATCHER);
Expand Down

0 comments on commit f5e5a1b

Please sign in to comment.