Language
C++
Compiler
gcc HEAD 11.0.0 20200515 (experimental)
Options
Warnings
Boost 1.73.0
C++2a(GNU)
Boost 1.73.0
C++2a(GNU)
Boost 1.73.0
C++2a(GNU)
Boost 1.73.0
C++2a(GNU)
Boost 1.73.0
C++2a(GNU)
no pedantic
Raw runtime options
vehicle_parts.txt
#include <algorithm>
#include <cstring>
#include <fstream>
#include <iostream>
#include <random>
#include <sstream>
#include <string>
#include <string_view>
#include <vector>
namespace space {
//! \brief A part of a spaceship
//!
//! \tparam Tag A tag to differentiate between different part types
template <typename Tag> class SpaceshipPart {
public:
explicit SpaceshipPart(std::string description)
: description_{std::move(description)} {
}
[[nodiscard]] const std::string& description() const {
return description_;
}
private:
std::string description_;
};
template <typename PartTag>
std::ostream& operator<<(std::ostream& out,
const SpaceshipPart<PartTag>& part) {
out << part.description();
return out;
}
super ionizing engine
small rocket engine
big rocket engine
lightspeed engine
small V-shaped wings
X-style wings
no wings
large plane wings
falcon-style fuselage
small streamline fuselage
tie-fighter fuselage
large cabin
small cabin
liquid armor
100% energy field armor
laser armor
rocket resistant armor
super laser shield
ionizing shield
laser cannon weapon
rocket launcher weapon
bubble gum launcher weapon
string tokens cannon weapon
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.73.0/gcc-head/include -std=gnu++2a
The wing type [X-style] is not a valid spaceship wing type, skipping
The wing type [no] is not a valid spaceship wing type, skipping
The part type [shield] is not a valid spaceship part, skipping
The part type [shield] is not a valid spaceship part, skipping
A ship with big rocket engine, tie-fighter fuselage, small cabin, 100% energy field armor and no weapons
A ship with small rocket engine, falcon-style fuselage, large cabin, large plane wings, rocket resistant armor and 1 weapon: rocket launcher weapon
Exit Code:
0