Junxiao Shi | 8d71fdb | 2014-12-07 21:55:19 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | from waflib.Configure import conf |
| 4 | |
Davide Pesavento | 96b96af | 2015-09-19 23:00:40 +0200 | [diff] [blame] | 5 | STD_TO_STRING = ''' |
| 6 | #include <string> |
| 7 | int |
Davide Pesavento | 7c02b47 | 2015-10-28 20:50:17 +0100 | [diff] [blame] | 8 | main() |
Davide Pesavento | 96b96af | 2015-09-19 23:00:40 +0200 | [diff] [blame] | 9 | { |
| 10 | std::string s = std::to_string(0); |
| 11 | s = std::to_string(0l); |
| 12 | s = std::to_string(0ll); |
| 13 | s = std::to_string(0u); |
| 14 | s = std::to_string(0ul); |
| 15 | s = std::to_string(0ull); |
| 16 | s = std::to_string(0.0f); |
| 17 | s = std::to_string(0.0); |
| 18 | s = std::to_string(0.0l); |
| 19 | s.clear(); |
Davide Pesavento | 96b96af | 2015-09-19 23:00:40 +0200 | [diff] [blame] | 20 | } |
| 21 | ''' |
| 22 | |
| 23 | @conf |
| 24 | def check_std_to_string(self): |
| 25 | if self.check_cxx(msg='Checking for std::to_string', |
| 26 | fragment=STD_TO_STRING, |
| 27 | features='cxx', mandatory=False): |
| 28 | self.define('HAVE_STD_TO_STRING', 1) |
| 29 | |
Joao Pereira | 7476ebf | 2015-07-07 14:54:39 -0400 | [diff] [blame] | 30 | VECTOR_INSERT_ERASE_CONST_ITERATOR = ''' |
| 31 | #include <vector> |
| 32 | int |
| 33 | main() |
| 34 | { |
| 35 | std::vector<int> v; |
| 36 | std::vector<int>::const_iterator it = v.cbegin(); |
| 37 | |
| 38 | v.insert(it, 2); |
| 39 | it = v.cend() - 1; |
| 40 | v.erase(it); |
Joao Pereira | 7476ebf | 2015-07-07 14:54:39 -0400 | [diff] [blame] | 41 | } |
| 42 | ''' |
| 43 | |
| 44 | @conf |
| 45 | def check_vector_const_iterators(self): |
Davide Pesavento | 96b96af | 2015-09-19 23:00:40 +0200 | [diff] [blame] | 46 | if self.check_cxx(msg='Checking for std::vector::insert with const_iterator', |
Joao Pereira | 7476ebf | 2015-07-07 14:54:39 -0400 | [diff] [blame] | 47 | fragment=VECTOR_INSERT_ERASE_CONST_ITERATOR, |
| 48 | features='cxx', mandatory=False): |
Davide Pesavento | 96b96af | 2015-09-19 23:00:40 +0200 | [diff] [blame] | 49 | self.define('HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR', 1) |
Joao Pereira | 7476ebf | 2015-07-07 14:54:39 -0400 | [diff] [blame] | 50 | |
Junxiao Shi | 8d71fdb | 2014-12-07 21:55:19 -0700 | [diff] [blame] | 51 | def configure(conf): |
Davide Pesavento | 96b96af | 2015-09-19 23:00:40 +0200 | [diff] [blame] | 52 | conf.check_std_to_string() |
Joao Pereira | 7476ebf | 2015-07-07 14:54:39 -0400 | [diff] [blame] | 53 | conf.check_vector_const_iterators() |