Changeset 11098
- Timestamp:
- Jan 26, 2016, 8:32:16 PM (9 years ago)
- Location:
- code/trunk/src/libraries/util
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/Convert.h
r8858 r11098 128 128 #include <sstream> 129 129 #include <typeinfo> 130 #include <type_traits> 130 131 #include <loki/TypeManip.h> 131 132 132 133 #include "Output.h" 133 #include "ImplicitConversion.h"134 134 135 135 // disable warnings about possible loss of data … … 308 308 struct ConverterExplicit 309 309 { 310 enum { probe = ImplicitConversion<FromType, ToType>::exists };310 static constexpr bool probe = std::is_convertible<FromType, ToType>::value; 311 311 ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input) 312 312 { -
code/trunk/src/libraries/util/MultiType.h
r11071 r11098 100 100 #include <cassert> 101 101 #include <string> 102 #include <utility> 102 103 #include <OgreVector2.h> 103 104 #include <OgreVector3.h> … … 310 311 /// Copyconstructor: Assigns value and type of the other MultiType. 311 312 inline MultiType(const MultiType& other) : value_(nullptr) { this->set(other); } 313 /// Moveconstructor: Moves the value and its type from the other MultiType 314 inline MultiType(MultiType&& other) : value_(nullptr) { std::swap(this->value_, other.value_); }; 312 315 313 316 /// Destructor: Deletes the MT_Value. … … 320 323 /// Assigns the value of the other MultiType and converts it to the current type of the MultiType. 321 324 inline MultiType& operator=(const MultiType& other) { this->set(other); return (*this); } 325 /// Moves the value and the type of the other MultiType to this one. 326 inline MultiType& operator=(MultiType&& other) { std::swap(this->value_, other.value_); return (*this); } 322 327 323 328 /// Assigns the given value and converts it to the current type. -
code/trunk/src/libraries/util/Sleep.cc
r8858 r11098 30 30 @file 31 31 @brief 32 Implementation of three sleep functions. Avoids including windows.h32 Implementation of three sleep functions. 33 33 */ 34 34 35 35 #include "Sleep.h" 36 #include "Output.h"37 36 38 #ifdef ORXONOX_PLATFORM_WINDOWS 39 #ifndef WIN32_LEAN_AND_MEAN 40 # define WIN32_LEAN_AND_MEAN 41 #endif 42 #include <windows.h> 43 #undef min 44 #undef max 37 #include <chrono> 38 #include <thread> 45 39 46 40 namespace orxonox … … 48 42 void usleep(unsigned long microseconds) 49 43 { 50 //if (microseconds < 1000) 51 // orxout(internal_warning) << "Windows cannot sleep less than 1ms, ignoring" << endl; 52 Sleep(microseconds / 1000); 44 std::this_thread::sleep_for(std::chrono::microseconds(microseconds)); 53 45 } 54 46 55 47 void msleep(unsigned long milliseconds) 56 48 { 57 Sleep(milliseconds);49 std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); 58 50 } 59 51 60 52 void sleep(unsigned long seconds) 61 53 { 62 Sleep(seconds * 1000);54 std::this_thread::sleep_for(std::chrono::seconds(seconds)); 63 55 } 64 56 } 65 66 #else /* Linux/Apple */67 #include <unistd.h>68 69 namespace orxonox70 {71 void usleep(unsigned long usec)72 {73 ::usleep(usec);74 }75 void msleep(unsigned long msec)76 {77 ::usleep(msec * 1000);78 }79 void sleep(unsigned long sec)80 {81 ::usleep(sec * 1000000);82 }83 }84 85 #endif -
code/trunk/src/libraries/util/SubString.h
r11071 r11098 115 115 public: 116 116 SubString(); 117 /// Copy constructor 118 SubString(const SubString& other) = default; 119 /// Move constructor 120 SubString(SubString&& other) = default; 117 121 SubString(const std::string& line, 118 122 const std::string& delimiters = SubString::WhiteSpaces, … … 133 137 // operate on the SubString 134 138 SubString& operator=(const SubString& other); 139 /// Move assignment 140 SubString& operator=(SubString&& other) = default; 135 141 bool operator==(const SubString& other) const; 136 142 bool compare(const SubString& other, size_t length = std::string::npos) const;
Note: See TracChangeset
for help on using the changeset viewer.