commit 9e447a34271f2384ed6d6b8df3addb4099ca3268
parent 43696817e24a180b4b04cf22b172d5e93ec78395
Author: Morel BĂ©renger <berenger.morel@neutralite.org>
Date: Mon, 17 Feb 2020 18:48:11 +0100
preparing vector replacement
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/merge.cpp b/merge.cpp
@@ -7,7 +7,6 @@
#include <ctype.h>
#include <algorithm>
-
#include <vector>
/**
@@ -42,6 +41,10 @@
* * const affect what is before it, so it must follow the type;
**/
+class field_marker;
+typedef std::vector<char> line_cache;
+typedef std::vector<field_marker> field_marker_t;
+
class field_marker
{
uint16_t m_start = UINT16_MAX, m_end = UINT16_MAX;
@@ -73,7 +76,7 @@ public:
bool allocate_markers(
char const * const FIELDS,
- std::vector<field_marker>& field_cache
+ field_marker_t& field_cache
);
int main( void )
@@ -105,7 +108,7 @@ int main( void )
return EXIT_FAILURE;
}
- std::vector<field_marker> field_cache;
+ field_marker_t field_cache;
if( allocate_markers( FIELDS, field_cache ) )
{
return EXIT_FAILURE;
@@ -129,7 +132,6 @@ int main( void )
}
bool fetch = true;
- typedef std::vector<char> line_cache;
line_cache last_line;
char const * const SEP_END = SEP_START + strlen( SEP_START );
while( !feof( stdin ) )
@@ -248,7 +250,7 @@ int main( void )
bool allocate_markers(
char const * const FIELDS,
- std::vector<field_marker>& field_cache
+ field_marker_t& field_cache
)
{
field_cache.reserve( UINT8_MAX ); //255 fields should fit most cases